赞
踩
在运行python文件时报错,提示AttributeError: partially initialized module 'keyword' has no attribute 'kwlist' (most likely due to a circular import)
这是因为文件命与包(import 导入的 keyword包)名重复了,把文件命重新修改过就行了
1. 找到文件右击---->选择Refator---->Rename
2. 在1处从新修改文件名字---->refactor
3. 修改好之后可能会出现如下情况,把import keyword_demo改为 import keyword即可
4. 之后运行就不会报错啦。
提示:在创建包的时候,报名不要用关键字,在定义变量的时候变量也不要用关键字
关键字如下:
'False', 'None', 'True', 'and', 'as', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except','finally', 'for', 'from', 'global', 'if','import', 'in', 'is','lambda', 'nonlocal', 'not', 'or', 'pass','raise', 'return', 'try', 'while', 'with', 'yield'
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。