L = ['L','O','L']
makeitastringdammit = ''.join(map(str, L))
本文介绍了如何将Python列表转换为字符串的方法。包括直接使用''.join()函数连接字符串列表,以及先将整数列表转换为字符串后再进行连接的过程。
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 = ['L','O','L'] makeitastringdammit = ''.join(map(str, L))
1万+

被折叠的 条评论
为什么被折叠?