How to convert list to string [duplicate] How to convert list to string [duplicate] python python

How to convert list to string [duplicate]


By using ''.join

list1 = ['1', '2', '3']str1 = ''.join(list1)

Or if the list is of integers, convert the elements before joining them.

list1 = [1, 2, 3]str1 = ''.join(str(e) for e in list1)


>>> L = [1,2,3]       >>> " ".join(str(x) for x in L)'1 2 3'


L = ['L','O','L']makeitastring = ''.join(map(str, L))


matomo