Python学习笔记:‘’AttributeError: NoneType object has no attribute‘’
生活随笔
收集整理的這篇文章主要介紹了
Python学习笔记:‘’AttributeError: NoneType object has no attribute‘’
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
前言
最近在學(xué)習(xí)python,犯了很多低級錯誤,總結(jié)一下
目錄
文章目錄
- 前言
- 目錄
- 問題
- 出處
- 方案
問題
AttributeError: ‘NoneType’ object has no attribute ‘text’
出處
difficult = obj.find('difficult').text方案
錯誤提示的是空元素,沒有對應(yīng)的屬性。
<object><name>1</name><pose>Unspecified</pose><truncated>0</truncated><Difficult>0</Difficult>仔細查看可知,原文檔中是Difficult而不是difficult。
對應(yīng)于這類錯誤,以后要更加小心檢查大小寫。
如果大家還是有什么不會的,可以關(guān)注一下這個公眾號,博主會在24小時內(nèi)回應(yīng):
總結(jié)
以上是生活随笔為你收集整理的Python学习笔记:‘’AttributeError: NoneType object has no attribute‘’的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 数据结构中单链表的存储c语言,单链表一
- 下一篇: asp网站短信api服务器,asp短信接