以下是json格式的字典,目前问题:
(1)无法获取“content”下面的数据。已经解决,感谢🙏
(2)请问同时在indexList下面出现多组'columns'和'content'字典的时候,如何准确选取所需的'content'字典。想自动生成excel文件😂
系统报错为:AttributeError: 'list' object has no attribute 'keys'
{"success":"true","data"{"totalcolumns":10,indexList[{"columns":[{"a":"1","b":"2"}],"content":[{"a":"2","b":"3"},{"columns":[{"a":"3","b":"4"}],"content":[{"a":"4","b":"5"}]}]}}
代码为:
with open("./01的副本.json", "r", encoding="utf-8") as f:
dic = json.load(f)
dic['data']['indexList']['content']
df = pd.DataFrame(dic['data']['indexList']['content'])
麻烦各位帮帮忙!