为什么re2的结果与Python中的re模块不同?
我试着用 结果:为什么re2的结果与Python中的re模块不同?,python,regex,re2,Python,Regex,Re2,我试着用 结果: cde 1 Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'NoneType' object has no attribute 'group' 但re2的结果不同 import re2 print re2.search('cde', 'abcdefg').group(0) 结果: cde 1 Traceback (
cde
1
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'NoneType' object has no attribute 'group'
但re2的结果不同
import re2
print re2.search('cde', 'abcdefg').group(0)
结果:
cde
1
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'NoneType' object has no attribute 'group'
1
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
AttributeError:“非类型”对象没有属性“组”
re2
1re模块的结果不同(未找到=>返回无)
谢谢这是0.2.20版的错误。看看这个或这个。您最好从github克隆源代码,然后安装它。不要通过pip安装。哦,这个问题已经通过github版本解决了。非常感谢。