小编Ilu*_*ics的帖子

Python拆分单词但返回字母

我想将此文本拆分为单词,但 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)

python split

-6
推荐指数
1
解决办法
4059
查看次数

标签 统计

python ×1

split ×1