Python 属性错误的求解
当我编写python程序时,外星人入侵 AttributeError:“设置”对象没有属性“车队方向” 我在第81行得到这个错误,当你试图调用一个没有这个属性的对象上的属性字段或方法时,check_play button会发生 例如,这里我得到一个AttributeError,因为object Player没有名为inventory的字段或方法: 职业球员: 定义初始自我,健康: 自我健康 player=Player10 printplayer.inventory AttributeError在此 在这里,您似乎试图在没有此属性的对象设置上设置用户的方向属性。错误非常明显Python 属性错误的求解,python,Python,当我编写python程序时,外星人入侵 AttributeError:“设置”对象没有属性“车队方向” 我在第81行得到这个错误,当你试图调用一个没有这个属性的对象上的属性字段或方法时,check_play button会发生 例如,这里我得到一个AttributeError,因为object Player没有名为inventory的字段或方法: 职业球员: 定义初始自我,健康: 自我健康 player=Player10 printplayer.inventory AttributeError在
请考虑阅读API的文档,如果您使用的是API,或者如果错误来自您创建的对象,请验证您的代码。< / P>请附上代码。
Traceback (most recent call last):
File "example.py", line 6, in <module>
print(player.inventory) # AttributeError here
AttributeError: 'Player' object has no attribute 'inventory'