python中list转字符串

 

命令:''.join(list)

其中,引号中是字符之间的分割符,如“,”,“;”,“\t”等等

如:

list = ["1", "2", "3", "4", "5"]

''.join(list) 结果即为:12345

','.join(list) 结果即为:1,2,3,4,5

# 坑: list 里面的数据类型必须是str的,int不可以。

命令:''.join(list)

其中,引号中是字符之间的分割符,如“,”,“;”,“\t”等等

如:

list = ["1", "2", "3", "4", "5"]

''.join(list) 结果即为:12345

','.join(list) 结果即为:1,2,3,4,5

# 坑: list 里面的数据类型必须是str的,int不可以。

猜你喜欢

转载自www.cnblogs.com/zzllovehappy/p/10945134.html
今日推荐