(Sorry, I really meant this as a comment on Alex Martelli's answer, since mine is based on his; but when I originally posted I didn't have enough reputation to comment)
Alex's answer doesn't actually generate the intended result. I don't mean the finer points of having a list of lists of dicts, or the lack of commas between the lists (more on that later). But the original question wanted, as a result, a compilation of all medals by country, by competition. Alex's solution will answer:
> 'Germany': [{"Luge - Men's Singles": 'Gold'},
{"Luge - Men's Singles": 'Silver'},
{"Luge - Women's Singles": 'Gold'},
{"Luge - Women's Singles": 'Bronze'},
{'Luge - Doubles': 'Bronze'}]
But I believe the original question actually asked for:
> 'Germany': [{"Luge - Men's Singles": ['Gold', 'Silver']},
{"Luge - Women's Singles": ['Gold', 'Bronze'},
{'Luge - Doubles': 'Bronze'}]
The data in the question is a bit confusing, I see two possibilities:
1) The data shown is actually three different examples, and the task is to merge dict entries within each list, separately. That is, given
[{'Germany': {"Luge - Men's Singles": 'Gold'}},
{'Germany': {"Luge - Men's Singles": 'Silver'}},
{'Italy': {"Luge - Men's Singles": 'Bronze'}}]
you want
['Germany': {"Luge - Men's Singles": ['Gold', 'Silver'],
"Luge - Women's Singles": ['Gold', 'Bronze']},
'Italy': {"Luge - Men's Singles": ['Bronze']}]
, given
[{'Germany': {"Luge - Women's Singles": 'Gold'}},
{'Austria': {"Luge - Women's Singles": 'Silver'}},
{'Germany': {"Luge - Women's Singles": 'Bronze'}}]
you want
['Germany': {"Luge - Women's Singles": ['Gold', 'Bronze']},
'Austria': {"Luge - Women's Singles": ['Silver']}]
and so on. I gather this is the most likely interpretation of the question.
The following code does that:
from collections import defaultdict
merged = defaultdict(lambda: defaultdict(list))
for d in list_of_dicts:
for k in d:
for competition, medal in d[k].iteritems():
merged[k][competition].append(medal)
Running this for the first of the lists shown above, you get
defaultdict(<function <lambda> at 0x1907db0>,
{'Italy': defaultdict(<type 'list'>, {"Luge - Men's Singles": ['Bronze']}),
'Germany': defaultdict(<type 'list'>, {"Luge - Men's Singles": ['Gold', 'Silver']})})
2) The second possibility is that the data in the question is one single list, containing 3 lists, each of these containing dicts. I think this is not what the original question means, but, since I'd already written the code for that, here it is :)
from collections import defaultdict
merged = defaultdict(lambda: defaultdict(list))
for L in listoflistsofdicts:
for d in L:
for k in d:
for competition, medal in d[k].iteritems():
merged[k][competition].append(medal)
Running the code above for the lists shown on the question (with the necessary commas added, you get:
defaultdict(<function <lambda> at 0x1904b70>,
{'Italy': defaultdict(<type 'list'>, {"Luge - Men's Singles": ['Bronze']}),
'Austria': defaultdict(<type 'list'>, {'Luge - Doubles': ['Gold'],
"Luge - Women's Singles": ['Silver']}),
'Latvia': defaultdict(<type 'list'>, {'Luge - Doubles': ['Silver']}),
'Germany': defaultdict(<type 'list'>, {'Luge - Doubles': ['Bronze'],
"Luge - Men's Singles": ['Gold', 'Silver'],
"Luge - Women's Singles": ['Gold', 'Bronze']})
})
Please note that both of these codes don't sort medal types (i.e., you might end up with ['Gold', 'Silver'] or ['Silver', 'Gold']).
Of course, if you get separated lists as used in solution 1), but need a merge of all of them, simply bring them all together in a list, and use solution 2).