python 列表转换成字符串输出

列表转换成字符串输出

例如:我的列表是:
a=[1, 0, 0, 0, 0, 0, 0, 0]
然后输出100000
字符之间有无空格:
没有空格:

 
     
1
 
     
"".join(map(int, a))

有空格:

 
     
1
 
     
" ".join([str(a[i])+str(a[i+1]) for i in range(0, len(a),2)])

字符的类型需要修改,int或者str其他类型。

原文链接:http://www.aisun.org/2017/10/Python+list+str/

猜你喜欢

转载自blog.csdn.net/qq_35843543/article/details/78183791