Lots of good answers, but they all use rather more code than I would for this, so here's my take, for what it's worth:
totals = {}
for k,v in original_list:
totals[k] = totals.get(k,0) + v
# totals = {'a': 2, 'c': 2, 'b': 7}
Once you have a dict like that, from any of these answers, you can use items
to get a list of tuples:
totals.items()
# => [('a', 2), ('c', 2), ('b', 7)]
And map list
across the tuples to get a list of lists:
map(list, totals.items())
# => [['a', 2], ['c', 2], ['b', 7]]
And sort if you want them in order:
sorted(map(list, totals.items()))
# => [['a', 2], ['b', 7], ['c', 2]]
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…