问题:
import re
a = 'xyz123'
b = re.findall('y..', a)
print(b)可是报错
AttributeError: 'module' object has no attribute 'findall'
同样re.search也报错
AttributeError: 'module' object has no attribute 'search‘
库内各个方法都用不了,该怎么办?
解决办法:
可能是库的 re.pyc文件dao有问题制, 删除 re.pyc文件,再重新执bai行du代码。zhi
>>>
>>> import re
>>> a='xyz123'
>>> b=re.findall('y..',a)
>>> print(b)
['yz1']
>>>
下一篇:学完了php容易找工作吗