string indices must be integers百度指数
时间: 2023-08-26 19:11:50 浏览: 41
"string indices must be integers"是一个常见的错误信息,意味着在代码中尝试使用一个字符串作为索引来访问一个不支持字符串索引的对象。在你提供的引用中,只有中的代码会导致这个错误。这是因为在循环中使用了字符串索引值来访问字典,而字典只支持使用整数或键来进行索引。所以,正确的方法是使用循环与`.values()`方法结合来访问字典的值,如所示。<em>1</em><em>2</em><em>3</em>
#### 引用[.reference_title]
- *1* [Python 错误:TypeError String Indices Must be Integers 【已解决】](https://blog.csdn.net/hihell/article/details/123370933)[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^chatsearchT0_1"}} ] [.reference_item]
- *2* *3* [已解决TypeError: string indices must be integers](https://blog.csdn.net/yuan2019035055/article/details/128427500)[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^chatsearchT0_1"}} ] [.reference_item]
[ .reference_list ]