There are two dictionaries
x={1:[\'a\',\'b\',\'c\']}
y={1:[\'d\',\'e\',\'f\'],2:[\'g\']}
I want another dictionary z which is a merged one
Counter() can be used in this case:
>>> x={1:['a','b','c']}
>>> y={1:['d','e','f'],2:['g']}
>>> from collections import Counter
>>> Counter(x) + Counter(y)
Counter({2: ['g'], 1: ['a', 'b', 'c', 'd', 'e', 'f']})
If desired result is a dict. You can use the following:
z = dict(Counter(x) + Counter(y))