python merge list into string

Do you want to know the details about “python merge list into string”. If yes, you’re in the correct post.

python merge list into string

>>> sentence = ['this','is','a','sentence']
>>> '-'.join(sentence)
'this-is-a-sentence'
# example of join() function in python

numList = ['1', '2', '3', '4']
separator=", "
print(separator.join(numList))

Final Thoughts

I hope this post helps you to know about “python merge list into string”. If you have any doubts regarding this tutorial please let us know via the comment section. Share this tutorial with your friends and family via social networks.

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coder Diksha. Here, I post about programming to help developers.

Share on:

Leave a Comment