I\'ve a nested dictionary.
>>> foo = {\'m\': {\'a\': 10}, \'n\': {\'a\': 20}}
>>>
I\'d like to filter specific values, b
A list comprehension can do this beautifully.
>>> foo = {'m': {'a': 10}, 'n': {'a': 20}}
>>> [v for v in foo.values() if 10 in v.values()]
[{'a': 10}]
You don't need the for loop or the list comprehension if you are matching against a known key in the dictionary.
In [15]: if 10 in foo['m'].values():
...: result = [foo['m']]
...:
In [16]: result
Out[16]: [{'a': 10}]