My list contains the following list of dictionary within dictionary:
list = [
{'a':{'aa':11,'ab':12}},
{'a':{'aa':21,'ab':22}},
{'a':{'aa':31,'ab':32}}]
I am finding it difficult to access and compile all of the ‘aa’ data into a single list due it be nested within the ‘a’ dictionary.
I have tried creating a new list of dictionaries using a for loop, as per below, but I just get the same result. The goal of this was to extract the dictionary from within the ‘a’ dictionary and create a new list of unnested dictionaries, which is a state that I am familiar with.
#initialize empty list
empty_list = []
for new_list in list:
empty_list.append(new_list)
Alvin Olay is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1