如何在python中将字符串转换为列表

时间:2012-10-29 10:06:05

标签: python

  

可能重复:
  Converting a string into a list in Python

如何将字符串转换为python中的列表,例如:'LIFE IS FULL'['LIFE','IS','FULL']

2 个答案:

答案 0 :(得分:5)

使用str.split()

>>> strrs="LIFE IS FULL"
>>> strrs.split()
['LIFE', 'IS', 'FULL']

答案 1 :(得分:1)

您可以使用.split方法:

a = "LIFE IS FULL"
b = a.split()
['LIFE','IS','FULL']