python list转换字符串报错 TypeError: sequence item 0: expected str instance, int found
L = [1,2,3,4,5]
print(','.join(L))
以上写法会报错,TypeError: sequence item 0: expected str instance, int found
原因:list包含数字,不能直接转化成字符串
修改成 print(','.join(str(n) for n in L)) 就可以了