Name

.join()

Examples
separator = ' and '            # String to separate sequence items by.
words = ['this', 'that']       # String to join.
joined = separator.join(words) # Join items in sequence words,
                               # separated by 'separator'.
print(joined)

polyhedra = ["cube", "dodecahedron", "icosahedron"]

# The .join() method is often called on a string literal, without assigning it
# to a variable first.
joined = ", ".join(polyhedra)

print(joined) # Prints "cube, dodecahedron, icosahedron"
Description Combines a sequence of strings to create a new string, separating each item from the sequence with the content of the string the method is called on.
Syntax
	separator.join(sequence)
Parameters
separatorThe string to insert between elements of the sequence.
sequenceA sequence (e.g., list or tuple) of strings to be joined together.
Related String Formatting
.find()
.strip()
.split()
.replace()

Updated on Tue Feb 27 14:07:12 2024.

If you see any errors or have comments, please let us know.