Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
可能重复: 在 Python 中将字符串转换为列表
'LIFE IS FULL'如何将字符串转换为python中的列表,例如:['LIFE','IS','FULL']
'LIFE IS FULL'
['LIFE','IS','FULL']
使用str.split():
str.split()
>>> strrs="LIFE IS FULL" >>> strrs.split() ['LIFE', 'IS', 'FULL']
您可以使用以下.split方法:
.split
a = "LIFE IS FULL" b = a.split() ['LIFE','IS','FULL']