Python列表list转字符串报错:expected str instance, int found
代码中定义了一个字符串:
alist=[1,2,3,4,5]
结果''.join(alist)报错(因为列表中数据为整型),
expected str instance, int found
解决方法:
''.join(str(alist))
Python列表list转字符串报错:expected str instance, int found
代码中定义了一个字符串:
alist=[1,2,3,4,5]
结果''.join(alist)报错(因为列表中数据为整型),
expected str instance, int found
解决方法:
''.join(str(alist))