Problem
In Python, how do I convert a list to a string?
Asked by Nm3
Solution #1
By using ”.join
list1 = ['1', '2', '3']
str1 = ''.join(list1)
Alternatively, if the list is made up entirely of integers, convert the entries first before joining them.
list1 = [1, 2, 3]
str1 = ''.join(str(e) for e in list1)
Answered by Senthil Kumaran
Solution #2
>>> L = [1,2,3]
>>> " ".join(str(x) for x in L)
'1 2 3'
Answered by Andrey Sboev
Solution #3
L = ['L','O','L']
makeitastring = ''.join(map(str, L))
Answered by Nathan
Post is based on https://stackoverflow.com/questions/5618878/how-to-convert-list-to-string