我想将此文本拆分为单词,但 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', …Run Code Online (Sandbox Code Playgroud)