Python list indices must be integers or slices, not tuple
时间: 2023-08-25 19:13:37 浏览: 161
问题: Python list indices must be integers or slices, not tuple
回答: 当出现"list indices must be integers or slices, not tuple"的错误时,这通常是因为在使用列表时将元组作为索引值传递给列表。解决这个错误的方法很简单,我们只需要将元组转换为整数或者切片类型即可。初学Python的同学可以多加注意,避免该错误的出现。<em>1</em><em>2</em><em>3</em>
#### 引用[.reference_title]
- *1* *2* [Python错误解决:list indices must be integers or slices, not tuple](https://blog.csdn.net/update7/article/details/129775173)[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]
- *3* [python报错 list indices must be integers or slices, not tuple](https://blog.csdn.net/Electrical_IT/article/details/114916652)[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]
[ .reference_list ]