join() string method in Python

The join() string method joins elements of an iterable into a single string using the given separator.

Syntax separator.join(iterable)

Example:

Python

fruits = ["apple", "banana", "cherry"]
print(" - ".join(fruits))  
# Output: apple - banana - cherry

Special Note: Only works with iterables of strings.