【发布时间】:2019-04-20 14:40:26
【问题描述】:
我无法弄清楚为什么这不匹配。如果有人可以在这里帮助我,我将不胜感激。
print(re.match(r"Newton", "Isaac Newton , physicist"))
【问题讨论】:
-
re.match只匹配字符串的start。 -
因为你的字符串不是以
Newton开头的。也许你想要re.search -
python 2.7 的 re 模块的文档在这里 docs.python.org/2/library/re.html - 向下滚动以找到
match