ReferenceString methods
str.join()
Glues strings together with the separator between them.
Signature
separator.join(iterable)Parameters
| Name | Means |
|---|---|
iterable | strings to join; every item must already be a string |
Returns
One new string.
Example
Python
print(", ".join(["a", "b", "c"]))
print("".join(["a", "b"]))
print(", ".join(str(n) for n in [1, 2]))Output
a, b, c ab 1, 2