例如在以下文本中:
"We’d love t0 help 123you, but the real1ty is th@t n0t every question gets answered. To improve your chances, here are some tips:"
如何轻松提取只包含字母的单词:
^{pr2}$我试过了
words = re.findall(r'^[a-zA-Z]+',str)
for word in words:
print word
其中str
是文本。这做了一些工作,但我需要做些调整。在
对正则表达式有什么想法吗?在
你可以使用列表理解。在
s.split()
将根据空格拆分输入。在相关问题 更多 >
编程相关推荐