快速合并两个字典
x = {'a':1, 'b':3}
y = {'c': 5, 'd': 8}
z = dict(list(x.items()) + list(y.items()))
print(z)<br>
# {'d': 8, 'c': 5, 'a': 1, 'b': 3}
python 3.5之后更简便的方法:
x = {'a':1, 'b':3}
y = {'c': 5, 'd': 8}
#z = dict(list(x.items()) + list(y.items()))
z = {**x, **y}
print(z)

浙公网安备 33010602011771号