Python 3 string.join() equivalent?


I’ve been using string.join() method in python 2 but it seems like it has been removed in python 3. What is the equivalent method in python 3?

string.join() method let me combine multiple strings together with a string in between every other string. For example, string.join((“a”, “b”, “c”), “.”) would result “a.b.c”.

Asked By: Dennis



'.'.join() or ".".join().. So any string instance has the method join()

Answered By: Tim

There are method join for string objects:


Answered By: werewindle

str.join() works fine in Python 3, you just need to get the order of the arguments correct

>>> str.join('.', ('a', 'b', 'c'))
Answered By: hobs


s=" "
seq=["ab", "cd", "ef"]

ab cd ef


Answered By: Jamil Ahmad
Categories: questions Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.