python how to merge two dictionaries code example
Example 1: join two dictionaries python
z = {**x, **y}
Example 2: merge two dict python 3
z = {**x, **y}
Example 3: merge a list of dictionaries python
>>> from collections import ChainMap
>>> a = [{'a':1},{'b':2},{'c':1},{'d':2}]
>>> dict(ChainMap(*a))
{'b': 2, 'c': 1, 'a': 1, 'd': 2}
Example 4: concatenate two dictionnaries python
d1.update(d2)