apppublic/appPublic/dictExt.py
2019-07-16 16:33:07 +08:00

21 lines
352 B
Python
Executable File

def dictExtend(s,addon):
ret = {}
ret.update(s)
skeys = ret.keys()
for k,v in addon.items():
if k not in skeys:
ret[k] = v
continue
if type(v)!=type(ret[k]):
ret[k] = v
continue
if type(v)==type({}):
ret[k] = dictExtend(ret[k],v)
continue
if type(v)==type([]):
ret[k] = ret[k] + v
continue
ret[k] = v
return ret