原文:TypeError: 'CommandCursor' object is not subscriptable 問題解決

TypeError: CommandCursor object is not subscriptable 我用的是pymongo 查詢出來數據然后報這個錯誤 查詢了消息發現查詢出來的數據類型是commandcursor 不能帶有 result 於是去掉 注意:后面的數組操作也要更換需要轉換成list具體可以看pymongo的CommandCursor源碼可以看看有哪些屬性也可查詢官網點擊此處 轉發 ...

2018-06-11 13:27 0 1045 推薦指數:

查看詳情

TypeError: 'NoneType' object is not subscriptable

查詢數據庫報錯復現: 我在使用 pymongo 訪問 users collection 里的數據時, 由於該條數據不存在,所以 user 的值變成了 None。 但是我又像下面這樣 ...

Wed Jan 15 04:03:00 CST 2020 0 764
TypeError: 'NoneType' object is not subscriptable

運行,顯示TypeError: 'NoneType' object is not subscriptable錯誤信息,原因是變量使用了系統內置的關鍵字list 重新定義下這個變量就好了 ...

Fri Aug 31 23:21:00 CST 2018 0 46375
 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM