本文介绍了为什么会出现AttributeError:'NoneType'对象没有属性'something'?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我不断收到错误消息
AttributeError: 'NoneType' object has no attribute 'something'
我的代码太长了,无法在此处发布.什么一般情况会导致此AttributeError
,什么是NoneType
意味着什么,以及如何缩小正在发生的情况?
The code I have is too long to post here. What general scenarios would cause this AttributeError
, what is NoneType
supposed to mean and how can I narrow down what's going on?
推荐答案
NoneType意味着您实际上得到了None
,而不是您认为正在使用的任何类或对象的实例.这通常意味着在上面的赋值或函数调用失败或返回了意外结果.
NoneType means that instead of an instance of whatever Class or Object you think you're working with, you've actually got None
. That usually means that an assignment or function call up above failed or returned an unexpected result.
这篇关于为什么会出现AttributeError:'NoneType'对象没有属性'something'?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!