join method is used for to join the strings . especially used for the list and tuples
example 1:
list joining using join method
s=["anil", "durgam", "embedded"]
l="-".join(s)
print(l)
output:
anil-durgam-embedded
example 2:
tuple joining with join method
s=("anil", "durgam", "embedded")
l="-".join(s)
print(l)
output:
anil-durgam-embedded
example 3:
s=("anil", "durgam", "embedded")
l=":".join(s)
print(l)
output:
anil:durgam:embedded
example 4:
s=("anil", "durgam", "embedded")
l=" ".join(s)
print(l)
output:
anil durgam embedded
example 5:
s=("anil", "durgam", "embedded")
l="".join(s)
print(l)
output:
anildurgamembedded
example 1:
list joining using join method
s=["anil", "durgam", "embedded"]
l="-".join(s)
print(l)
output:
anil-durgam-embedded
example 2:
tuple joining with join method
s=("anil", "durgam", "embedded")
l="-".join(s)
print(l)
output:
anil-durgam-embedded
example 3:
s=("anil", "durgam", "embedded")
l=":".join(s)
print(l)
output:
anil:durgam:embedded
example 4:
s=("anil", "durgam", "embedded")
l=" ".join(s)
print(l)
output:
anil durgam embedded
example 5:
s=("anil", "durgam", "embedded")
l="".join(s)
print(l)
output:
anildurgamembedded
No comments:
Post a Comment