Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
479 views
in Technique[技术] by (71.8m points)

python - 为什么会出现AttributeError:'NoneType'对象没有属性'something'?(Why do I get AttributeError: 'NoneType' object has no attribute 'something'?)

I keep getting an error that says

(我不断收到错误消息,说)

AttributeError: 'NoneType' object has no attribute 'something'

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?

(什么一般情况会导致此AttributeErrorNoneType应该是什么意思,以及如何缩小正在发生的情况?)

  ask by Jacob Griffin translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

NoneType means that instead of an instance of whatever Class or Object you think you're working with, you've actually got None .

(NoneType意味着实际上没有None ,而不是您认为正在使用的任何Class或Object的实例。)

That usually means that an assignment or function call up above failed or returned an unexpected result.

(这通常意味着在上面的赋值或函数调用失败或返回了意外结果。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...