In this section we will learn what String join() method is and how to use it in Python.
Python String Concatenation: join() Method
The Python string join() method is used to join the items of an iterable object and use the string value that this method is invoked with as the separator.
Python String join() Method Syntax:
string.join(iterableObject)
String join() Method Parameter
The method takes one argument, and that is a reference to the target iterable object that we want to join its items.
String join() Method Return Value
The return value of this method is a string value that contains the entire items of the target iterable object (the argument of this method) joined using the string value that this method is invoked with as the separator.
Example: using string join() method in Python
myTuple = ("Jack", "Ellen","John") result = "->".join(myTuple) print(result)
Output:
Jack->Ellen->John