I have the following dictionary
mylist = [{\'tpdt\': \'0.00\', \'tmst\': 45.0, \'tmdt\': 45.0, \'pbc\': 30, \'remarks\': False, \'shift\': 1, \'ebct\': \'0.
Here's a code that doesn't require mylist to be sorted by "mc_no" key:
mylist
"mc_no"
from collections import defaultdict sums = defaultdict(int) # key -> sum for d in mylist: sums[d["mc_no"]] += d["tmst"]