AttributeError: module 'ast' has no attribute 'parse'

版权声明:そう何簡単な諦めるわけないだろう。。 https://blog.csdn.net/Inuyasha_1314/article/details/80582037

死活查不出来,写了一个ast报这个错。

Traceback (most recent call last):
  File "C:\Users\HP\Desktop\ast.py", line 13, in <module>
    res = sc(path)
  File "C:\Users\HP\Desktop\ast.py", line 8, in sc
    ex = ast.parse(res,filename=path,mode = 'exec')
AttributeError: module 'ast' has no attribute 'parse'

终于还是被我发现了,猫腻原来在这里——命名问题。

这里写图片描述

这个文件的命名为ast.py,报错,改个名字,ast1.py,一切正常。

正常文件

猜你喜欢

转载自blog.csdn.net/Inuyasha_1314/article/details/80582037