last one for the night, want to see what clever ways there are with python to add all of the 'count' values from the following type of dictionary:
{0: {'count': 1000}, 1: {'count': 2000}}
so the end result should be an int value of 3000.
last one for the night, want to see what clever ways there are with python to add all of the 'count' values from the following type of dictionary:
{0: {'count': 1000}, 1: {'count': 2000}}
so the end result should be an int value of 3000.
>>> x = {0: {'count': 1000}, 1: {'count': 2000}}
>>> sum(v['count'] for v in x.values())
3000
How about using reduction in python?
reduce(lambda x,y: x+y, [v['count'] for v in a.values()])