python str,list,tuple转换

1. str转list
list = list(str)

2. list转str
str= ''.join(list)

3. tuple list相互转换
tuple=tuple(list)
list=list(tuple)

4. tuple 转换为字符串
In [1]: a = ('a',)

In [2]: ''.join(a)
Out[2]: 'a'
posted @   IT小工Joey  阅读(20077)  评论(0编辑  收藏  举报
努力加载评论中...
点击右上角即可分享
微信分享提示