You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

嵌套字典解析报错:TypeError: string indices must be integers 求助

问题:提取awayBattingTotals对应数据时触发类型错误

我想要提取与awayBattingTotals关联的字典键值对,操作流程如下:

  • 通过statsapi.boxscore_data(662647)和summary = statsapi.boxscore(662647)获取数据
  • 执行summary["awayBattingTotals"]["Totals"]尝试提取目标数据

但每次都会触发错误:

TypeError: string indices must be integers

相关JSON响应片段

{'namefield': '9 Lopez, N  SS','ab': '3',...,'homeBattingTotals': {...}}

内容的提问来源于stack exchange,提问作者sajeeni

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.23 01:33:24