2024-05-05 16:15:32 发布
网友
[{"Attachment": [ { "Page:": [ { "Path": "a\\b\\c.pdf", #field to be extracted "PageID": 1 } ] } ], "ID": 13221}]
我尝试了以下操作,但得到了TypeError:列表索引必须是整数,而不是str
with open(file) as f: d = json.load(f) print(d[0]['Attachment']['Page']['Path'])
d[0]['Attachment']是一个列表,d[0]['Attachment'][0]['Page:']也是一个列表。你知道吗
d[0]['Attachment']
d[0]['Attachment'][0]['Page:']
with open(file) as f: d = json.load(f) print(d[0]['Attachment'][0]['Page:'][0]['Path'])
我会做的。你知道吗
d[0]['Attachment']
是一个列表,d[0]['Attachment'][0]['Page:']
也是一个列表。你知道吗我会做的。你知道吗
相关问题 更多 >
编程相关推荐