Python Program to Convert List To String

Write a Python program to convert list to string. In Python, we can use the string join method to join or convert the list to string.

strlist = ["Kiwi", "USA", "UK", "India", "Japan"]

str1 = ' '
str1 = str1.join(strlist)
print(str1)
Python Program to Convert List To String

Python program to convert list to string using list comprehension. 

strlist = ["Learn", "Python", "From", "Tutorial", "Gateway"]

str1 = ' '.join([str(word) for word in strlist])
print(str1)
Learn Python From Tutorial Gateway

Python program to convert list to string using string join and map function. 

strlist = ["Learn", "Python", "From", "Tutorial", "Gateway"]

str1 = ' '.join(map(str, strlist))
print(str1)
Learn Python From Tutorial Gateway

In this Python convert list to string example, the for in loop iterates the list items and adds them to empty string. 

def listToString(strlist):
    str1 = ''

    for word in strlist:
        str1 = str1 + word + ' ' 

    return str1
        
strlist = ["Python", "Programs", "From", "Tutorial", "Gateway"]

print(listToString(strlist))
Python Programs From Tutorial Gateway 

In this Python example, we have shown all the possibilities to convert list to string. 

def listToString(strlist):
    str1 = ''

    for word in strlist:
        str1 = str1 + word + ' ' 

    return str1

strlist = ["Learn", "Python", "Program", "From", "Tutorial", "Gateway"]

str1 = ' '
str1 = str1.join(strlist)
print("join method output        = ", str1)

str2 = ' '.join([str(word) for word in strlist])
print("List Comprehension output = ", str2)

str3 = ' '.join(map(str, strlist))
print("map output                = ", str3)

print("Custom Function output    = ", listToString(strlist))
join method output        =  Learn Python Programs From Tutorial Gateway
List Comprehension output =  Learn Python Programs From Tutorial Gateway
map output                =  Learn Python Programs From Tutorial Gateway
Custom Function output    =  Learn Python Programs From Tutorial Gateway