操作正则表达式遇到的问题

学习正则表达式,文件名为re.py

import re
strr="张三李四王五赵六"
pat="王五"
result=re.search(pat,strr)
print(result)

运行后发现提示:
module 're' has no attribute 'search'

原因:文件名与python库名相同,所以导致这个问题,只需更改文件名即可
posted @ 2019-07-23 23:00  狂飙的老蜗牛  阅读(225)  评论(0编辑  收藏  举报