Combining a List of Strings Into a Single String
The join() method combines a list of strings passed as an argument into a single string. In our case, we separate them using the comma separator.
Python: 3.0    Chaitanya Baweja    04 Jul 2021   0
Login to upvote
1
2
3
4
5
6
7
list_of_strings = ['My', 'name', 'is', 'Chaitanya', 'Baweja']

# Using join with the comma separator
print(','.join(list_of_strings))

# Output
# My,name,is,Chaitanya,Baweja
Copy | Download as: .py file   PNG
Share on: FB   Twitter   LinkedIn   WA
©2021 - code108labs   Contributors   Hosted on DigitalOcean   Partner website: pythoncircle.com