我想我的python函数分割一个句子(输入),并将每个单词存储在一个列表中。到目前为止,我写的代码会分割句子,但不会将这些单词存储为列表。我怎么做?
def split_line(text):
# split the text
words = text.split()
# for each word in the line:
for word in words:
# print the word
print(word)
相似问题