Python 字典值相加

#字典值相加
def union_dic(*objs): _keys = set(sum([obj.keys() for obj in objs],[])) _total = {} for _key in _keys: _total[_key] = sum([obj.get(_key,0) for obj in objs]) return _total
相關文章
相關標籤/搜索