我有一堆字符串,如何将它们列入列表而没有单个单词列表?

时间:2014-11-20 09:41:23

标签: python

s = ('hi my name is, huh', '    ', '', 'my name is, what', 'my name is harry potter')
and turn it into:

l = ['hi my name is, huh', '    ', '', 'my name is, what', 'my name is harry potter']

我有一堆字符串,如何将它们列入列表而没有单独的单词列表?

1 个答案:

答案 0 :(得分:1)

使用list

>>> s = ('hi my name is, huh', '    ', '', 'my name is, what', 'my name is harry potter')
>>> list(s)
['hi my name is, huh', '    ', '', 'my name is, what', 'my name is harry potter']