好友
阅读权限40
听众
最后登录1970-1-1
|
import re
String1 = "cuicui1 cuicui2 cuicui8 meimei cuicui99"
MyRegex = "cuicui\d"
Compiled_Regex = re.compile(MyRegex, flags=re.I|re.M)
result1 = Compiled_Regex.findall(String1)
print (result1)
result2 = MyRegex.findall(String1) # 我这咋就不行了呢? 不解,求解答,谢谢。
print (result2)
['cuicui1', 'cuicui2', 'cuicui8', 'cuicui9']
Traceback (most recent call last):
File "<string>", line 9, in <module>
AttributeError: 'str' object has no attribute 'findall'
|
|
发帖前要善用【论坛搜索】功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。 |
|
|
|
|