这个错误意思是字符串的下标一定要是整数
出这种错误有多种可能,最形象直接的就是:

TypeError: string indices must be integers

 

 TypeError: string indices must be integers

 

 有点pyhton基础的都知道下标怎么能是字符串’0’,必须是整数0,1,2,3…

TypeError: string indices must be integers

 

 TypeError: string indices must be integers

 

 才是正确的

 

第二种是json格式导致的错误:

TypeError: string indices must be integers

 

报错如下:

 TypeError: string indices must be integers

 

 因为获取url的response(res)是个json数据,所以要json.loads(),才能把json格式转为python字典识别的格式。
正解:

TypeError: string indices must be integers

 

 

TypeError: string indices must be integers

 

相关文章:

  • 2022-12-23
  • 2021-08-06
  • 2021-12-19
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-07
  • 2021-05-20
相关资源
相似解决方案