首页 > 代码库 > Python 字典值相加

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

 

Python 字典值相加