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‘
本文出自 “Python” 博客,请务必保留此出处http://dzlly1.blog.51cto.com/932657/1708254
原文:http://dzlly1.blog.51cto.com/932657/1708254