我试图访问一个json文件值,它有多个层次结构。我发现了一个问题,告诉我怎么做,但我正试图用其中一个层作为变量。你知道吗
如果json文件看起来像
barnes -> value that stays the same -> split second
noble -> value that stays the same -> the ocean
chapters -> value that stays the same -> harry potter
还有20行
我有一个出版商的名单,我想拉标题,所以我已经尝试,而且出版商只有一个价值,我在寻找:
for i in listex:
listex.append(books[i]['valuethatstaysthesame']['title'])
它不允许我索引它。预期的输出将是打印所有的标题
所以如果名单是
listex = ['barnes', 'noble']
预期产出将是:
一瞬间,大海
目前没有回答
相关问题 更多 >
编程相关推荐