005_python对整数的拼接

一、

(1)需要把整数组成的列表或整数字符串混合的列表拼接成字符串,实现如下:

arr=[1,2,3,4,"5"]
print ','.join(map(str,arr))

print ','.join(i.__str__() for i in arr)
print ','.join(str(i) for i in arr)

print ','.join(i.__repr__() for i in arr)
------输出------
1,2,3,4,5
1,2,3,4,5
1,2,3,4,5
1,2,3,4,'5'

  

猜你喜欢

转载自www.cnblogs.com/arun-python/p/8985701.html
005