Hello guys. How are you all? I hope you all fine. In this tutorial we will learn about how to concatenate List of String in Python. so without wasting time lets learn about of this.
How to concatenate List of String in Python
concatenate List of String in Python
to concatenate List of String in Python just use map(). By using map() you can concatenate List of String in Python. So lets learn about of this without wasting time.
mylist = ['my', 'phone', 'number', 'is', 979798] print(" ".join(map(str, mylist)))
Output :my phone number is 979798
How to concatenate List of String in Python
to concatenate List of String in Python just use join(). By using join() you can concatenate List of String in Python. So lets learn about of this without wasting time.
mylist = ['I', 'love', 'pizza', 'and', 'burger'] print(" ".join(mylist))
Output :I love pizza and burger
concatenate list of strings python
To concatenate List of String in Python just use join(). By using join() you can concatenate List of String in Python. So lets learn about of this without wasting time.
mylist = ['I', 'love', 'pizza', 'and', 'burger'] print(" ".join(mylist))
Output :I love pizza and burger
Method 1: concatenate List of String Using map()
By using map() you can concatenate List in Python. So lets learn about of this without wasting time.
mylist = ['my', 'phone', 'number', 'is', 979798]
print(" ".join(map(str, mylist)))
Output :
my phone number is 979798
Method 2: Using join()
By using join() you can concatenate List in this way. So lets learn about of this without wasting time.
mylist = ['I', 'love', 'pizza', 'and', 'burger']
print(" ".join(mylist))
Output :
I love pizza and burger
Method 3: Using for loop
By using for loop you can concatenate List. So lets learn about of this without wasting time.
mylist = ['I', 'love', 'pizza', 'and', 'burger']
v1 = ""
for word in mylist:
v1 += str(word) + " "
print(v1)
Output :
I love pizza and burger
Conclusion
It’s all About this Tutorial. Hope all methods helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which method worked for you?
Also, Read