Skip to content
String Methods

join()

Join several strings together using this string as the separator.

str.join(iterable)

str.join() returns a string concatenated from the elements of iterable, using the calling string as the delimiter between each item.

Parameters

NameDescription
iterableAn iterable containing strings, such as a list of words.

Returns

One combined string.

Try it

Run it and change it
words = ["red", "green", "blue"]
print(", ".join(words))

Worth knowing

  • Strings only: All items in the iterable must be strings. If any element is an int or other type, convert with map(str, items) or a generator before calling join().

Related entries