typeerror :list indices must be integers or slices,not str
时间: 2023-09-29 11:02:25 浏览: 140
这个错误的意思是列表的索引必须是整数或切片,而不能是字符串。根据引用和引用的描述,这个错误可能是因为在代码中尝试使用字符串作为列表的索引。要解决这个错误,你应该检查代码中的索引操作,确保使用的是整数或切片。另外,还要检查你要访问的列表是否是真正的列表,而不是其他类型的对象,因为该错误也可能是由于尝试在非列表对象上使用索引操作引起的。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [已解决TypeError:List indices must be integers or slices , not str](https://blog.csdn.net/yuan2019035055/article/details/126149910)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [TypeError: list indices must be integers or slices, not str原理及解决方案](https://blog.csdn.net/weixin_52709752/article/details/124073184)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [Python BeautifulSoup [解决方法] TypeError: list indices must be integers or slices, not str](https://download.csdn.net/download/weixin_38590567/14871394)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
阅读全文