Python拆分单词但返回字母

Ilu*_*ics -6 python split

我想将此文本拆分为单词,但 split() 一直向我返回字母而不是整个单词。

f="""Police have seized fake money being used to buy goods in ALAWA. An 
investigation is underway to locate where it came from. It's understood 50 
dollar notes with Chinese symbols have emerged at a Woolworths, butcher 
and bottle shop."""
words = set(line.strip() for line in f)
print(words)
Run Code Online (Sandbox Code Playgroud)

这是我收到的输出:

{'', 'u', 's', 'l', '(', 'o', 'D', 't', '3', '/', 'I', 'C', 'T', '1', '-', '+', 'i', '6', '0', 'g', 'Q', '8', 'M', 'm', 'z', 'y', '4', 'O', 'v', '2', ':', 'U', 'f', 'B', 'w', 'L', 'V', 'a', 'S', 'k', "'", '5', 'R', '•', 'p', 'P', 'e', 'X', 'd', 'b', 'n', 'r', 'A', 'W', ',', '7', '9', ')', 'c', 'h', 'N', '.', '&'}
Run Code Online (Sandbox Code Playgroud)

你知道为什么吗?

Tao*_*lam 5

简单地写:

words = set(f.split()) #you have used strip instead of split
Run Code Online (Sandbox Code Playgroud)