定义变量:
x = {'a': 1, 'b': 2}
y = {'b': 3, 'c': 4}
使用Python3:
z = {**x, **y}
使用Python2
z = dict(x, **y)
[1]: https://doc.niknk.com/usr/uploads/2019/12/1158661619.jpeg
x = {'a': 1, 'b': 2}
y = {'b': 3, 'c': 4}
z = {**x, **y}
z = dict(x, **y)
[1]: https://doc.niknk.com/usr/uploads/2019/12/1158661619.jpeg
评论区