python 列表转化为字符串的两种方式

python 列表转化为字符串的两种方式

(1)方式一

>>> juice=['orange','a','b']
>>> ''.join(juice)
'orangeab'

 

 

(2)方式二:

>>> juice=['orange','a','b']
>>> content='%s'*len(juice) % tuple(juice)
>>> print content
orangeab
>>>

 

参考网址:http://www.openstack.org.cn/bbs/forum.php?mod=viewthread&tid=506

你可能感兴趣的:(python列表,python列表转化为字符串)