爬取网站json图片报错TypeError: string indices must be integers

爬取网站json图片报错
图片说明
图片说明

报错:TypeError: string indices must be integers

print(web)看看输出什么,是不是本身已经是一个字符串了。

因为pics是字符串,并不是数组,需要转化下

for i in json.loads(web)
    pirnt(i['url'])

已经解决了,谢谢大家。获取的pics是字符串,我用eval转了一下变成了列表,然后我再加了个列表[1,2,3,……],再合成字典。。。反正就是转了很多弯弄好了