运维网's Archiver
论坛
›
Python
› Python 字符串、列表转换
42121
发表于 2015-11-2 10:36:52
Python 字符串、列表转换
1、字符转化为字典
例如:
name="alex,erric"
name_list=name.split(',')
print name_list
['alex','erric']
2、列表转化为字符串
name_list=['alex','eric','tony']
name=','.join.(name_list)
print name
'alex,eric,tony'
页:
[1]
查看完整版本:
Python 字符串、列表转换