it seems a simple task:
I am trying to merge 2 dictionaries without overwriting the values but APPENDING.
a = {1: [(1,1)],2: [(2,2),(3,3)],3: [(4,4)]}
If you want a third dictionary that is the combined one I would use the collection.defaultdict
from collections import defaultdict
from itertools import chain
all = defaultdict(list)
for k,v in chain(a.iteritems(), b.iteritems()):
all[k].extend(v)
outputs
defaultdict(, {1: [(1, 1)], 2: [(2, 2), (3, 3)], 3: [(4, 4), (5, 5)], 4: [(6, 6)]})