I have a list of dictionaries. e.g:
list = [ {list1}, {list2}, .... ] One of the key-value pair in each dictionary is another dictionary. Ex
list1 = { "key1":"val11", "key2":"val12", "key3":{"inkey11":"inval11","inkey12":"inval12"} } list2 = { "key1":"val21", "key2":"val22", "key3":{"inkey21":"inval21","inkey22":"inval22"} } I was thinking of getting all values of key3 in the all the dictionaries into a list. Is it possible to access them directly (something like list[]["key3"] ) or do we need to iterate through all elements to form the list?
I have tried
requiredlist = list [ ] ["key3"].
But it doesn't work. The final outcome I wanted is
requiredlist = [ {"inkey11":"inval11","inkey12":"inval12"}, {"inkey21":"inval21","inkey22":"inval22"} ]