Important Notice:

Course Content
The Calendar Module
Library Function/Predefined Functions
0/4
Sys Module
Library Function/Predefined Functions
0/2
OS Module
Library Function/Predefined Functions
0/2
Functions in Python (Chapter-10) M3-R5
About Lesson

join( ):-

            The join() method takes all items in an iterable and joins them into one string. A string must be specified as the separator.

Syntax:-                       string.join(iterable)

myTuple = (“John”, “Peter”, “Vicky”)

x = “#”.join(myTuple)

print(x)

Output

John#Peter#Vicky

myDict = {“name”: “John”, “country”: “Norway”}

mySeparator = “TEST”

x = mySeparator.join(myDict)

print(x)

Output

nameTESTcountry

Note: When using a dictionary as an iterable, the returned values are the keys, not the values.

error: Content is protected !!