本文翻译自:How to convert list to string [duplicate]
Possible Duplicate: 可能重复:
How can I convert a list to a string using Python? 如何使用Python将列表转换为字符串?
#1楼
参考:https://stackoom.com/question/NZj4/如何将列表转换为字符串-重复
#2楼
By using ''.join
使用''.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)
#3楼
>>> L = [1,2,3]
>>> " ".join(str(x) for x in L)
'1 2 3'
#4楼
L = ['L','O','L']
makeitastring = ''.join(map(str, L))