Python access dictionary inside list of a dictionary

Viewed 65513

Hi I have the below dictionary which has a value with a list, and inside the list is a dictionary. Is there a way to call the dictionary value inside the list using the key instead of the list index? The dictionary inside the list may vary so the index value may not always provide the right key value pair. But if I am able to use the key I can always get the correct value.

mylist = {'mydict': [{'A': 'Letter A'}, {'B': 'Letter C'}, {'C': 'Letter C'}]}
print(mylist['mydict'][0]['A'])

Current Output:

Letter A

Desired Query:

print(mylist['mydict']['A'])
Letter A
5 Answers
Related