[ad_1]
Use Counter
>>> from collections import Counter
>>> c=Counter()
>>> for d in l:
... c.update(d)
...
>>> dict(c)
{'a': 30, 'b': 15}
1
[ad_2]
solved python : Get the sum of values of a key in list of dictionaries [duplicate]
[ad_1]
Use Counter
>>> from collections import Counter
>>> c=Counter()
>>> for d in l:
... c.update(d)
...
>>> dict(c)
{'a': 30, 'b': 15}
1
[ad_2]
solved python : Get the sum of values of a key in list of dictionaries [duplicate]