我遇到了这个问题,我应该编写一个程序来吃几个单词(用逗号分隔)并用这些单词吐出一个干净的列表。我无法解决我的问题。有任何想法吗?
def wordlist(word):
return word.split(',')
def main ():
sentence = input("write a few words and seperate them with , ")
splitsentence = wordlist(sentence)
for item in splitsentence:
print(item)
main()