【发布时间】:2017-07-14 21:39:02
【问题描述】:
我目前正在学习 Python 中的正则表达式,我对正则表达式真正匹配的内容感到困惑。比如'\\'其实就是'\',那么如果我需要匹配字符串'abc\\cde'中的'\'呢? re.findall(r'\', '010\\aa') 根本不起作用。感谢您的帮助。
【问题讨论】:
-
re.findall(r'\\', '010\\aa') -
原始字符串中不能有尾部反斜杠:stackoverflow.com/questions/647769/…
-
Pythex pythex.org> 是尝试正则表达式并查看其工作原理的好方法。
-
@jonrsharpe 现在我明白我的代码出了什么问题,谢谢!
标签: python regex python-2.7