Scripting >> Python >> Examples >> Iterators >> How to concatenate all items in an iterable - list, tuples, lists into a single string with a separator between items

>>> mylist=['a','b','c','d']
>>> print(":".join(mylist))
a:b:c:d

 

>>> mytuple=('a','1','b','2')
>>> print(";".join(mytuple))
a;1;b;2