Python JSON TypeError list indices must be integers or slices, not str

前端 未结 2 1298
北海茫月
北海茫月 2020-12-16 08:06

I am currently trying to parse some data from a post request response and I keep getting this error: \"TypeError: list indices must be integers or slices, not str\"

2条回答
  •  长情又很酷
    2020-12-16 09:06

    data['result']['results'] is an array so you can't do ['name'] you need an int, you could add [0] after['results'] and it should work. Then you can reference keys within the object in results.

提交回复
热议问题