本文共 418 字,大约阅读时间需要 1 分钟。
1.文件名不能与模块名冲突
报错信息:
Traceback (most recent call last):
File "./re160418.py", line 4, in <module> import re File "/home/python/re.py", line 26, in <module> regular expressions; they simply match themselves. You can AttributeError: 'module' object has no attribute 'compile' 解决方法:[root@node1 python]# mv re.py re160418.py --将文件名不能与re模块同名