我有一个 API,其响应类似于以下 json 数据:
我该如何编写一个Python程序,让它能够返回键值
{
"a":1,
"b":2,
"c":[
{
"d":4,
"e":5,
"f":{
"g":6
}
}
]
}
我该如何编写一个Python程序,让它能够返回键值
['d', 'e', 'g']
。我尝试了以下代码:jsonData = request.json() #request is having all the response which i got from api
c = jsonData['c']
for i in c.keys():
key = key + str(i)
print(key)
['d','e','g']
还是['d','e','f']
键? - Andriy Ivaneyko