怎么样:
dict((x, a.get(x, 0) + b.get(x, 0)) for x in set(a)|set(b))
例:
>>> a = {'a':1, 'b':2, 'c':-3, 'e':5, 'f': 5}>>> b = {'b':3, 'c':4, 'd':5, 'e':-5, 'f': -6}>>>>>> dict((x, a.get(x, 0) + b.get(x, 0)) for x in set(a)|set(b)){'e': 0, 'a': 1, 'f': -1, 'd': 5, 'c': 1, 'b': 5}

![当净值不是正数时,将两个python字典合并为一个[重复] 当净值不是正数时,将两个python字典合并为一个[重复]](http://www.mshxw.com/aiimages/31/517188.png)
