不会跑

work for life

29 Jul 2016

Python—-str,list,dict,set,tuple的互相转换和操作

Python的字符操作很常用,应此需要熟记于心;

将str转换为list以及list转化为str:

>>>s='abcdef'
>>>l=list(s)
>>>l
>>>['a', 'b','c','d','e','f']
>>>''.join(l)
>>>'abcdef'
comments powered by Disqus