python练习时出现module 're' has no attribute 'match'错误

python练习时出现module 're' has no attribute 'match'错误

jiezi
2018-04-06 / 0 评论 / 0 阅读 / 正在检测是否收录...

练习python中正则表达式,使用import re,并且写了最简单的匹配,运行py文件,却提示module 're' has no attribute 'match'错误。

仔细查看原因,原来是自己把python package写成了re了。

导致python在执行import re时,以为我们要他导入我自己定义的package呢,将包名字改成retest,重新运行py文件,成功运行。

0

评论 (0)

取消