Home >>Python String Methods >Python String join() Method

Python String join() Method

Python String join() Method

Python String join() Method in python is used to return a new string which is iterable and joins them into one string by str separator. It is important that a string must be specified as the separator.

Syntax:
string.join(iterable)

Parameter Values

Parameter Description
iterable It is Required where all the returned values are strings
Here is an Example of Python String join() Method:

myjoins = ("Ram", "Vicky", "Shyam")
x = "#".join(myjoins)
print(x)

Output:
Ram#Vicky#Shyam
Example 2:

str = ""  
joins1 = ['p','h','p','t','p','o','i','n','t'] 
str2 = str.join(joins1)  
print(str2)  

Output:
phptpoint

No Sidebar ads