Python字符串,元组,列表之间的转换
1.列表转换成字符串
list1=["aa","bb","cc"]
str1=''.join(list1)#使用join连接列表元素
print(str1)
运行结果:
aabbcc
2.元祖转换成字符串
tuple1=('hello','world','!')
str1="".join(tuple1)#使用join连接元祖元素
print(str1)
运行结果:
helloworld!
3....
原创
2020-04-10 21:11:48 ·
1370 阅读 ·
0 评论