#字典值相加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
本文共 246 字,大约阅读时间需要 1 分钟。
#字典值相加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
转载于:https://www.cnblogs.com/iwangzc/p/4064410.html