How to get a key from inside another key in python

Hey does anybody know how I would go about getting the value of a key which is already inside another key like this:

a = {"fruit":[{"oranges":['10']},{"apples":['11']}]}
print(a.get("fruit"))

I can get the value of "fruit" but how would I get the value of "oranges".
Thank you for any help in advance.

>Solution :

You just have to access the first element of the list inside fruits, and then access the key inside

print(a['fruit'][0]['oranges']

Leave a Reply