WebLinuxStudy

导航

 

对于非纯字符串组成的列表,需要使用map(str, 列表)转换,纯字符串组成的列表则不需要转换

list1 = [1, 2, 3, 4, 5]
c = ','.join(map(str,list1))
print(c)
print(type(c))


list2 = ['1', '2', '3', '4', '5']
d = ','.join(list2)
print(d)
print(type(d))


 

posted on 2019-11-28 22:33  WebLinuxStudy  阅读(1084)  评论(0编辑  收藏  举报