dictionary concatenation in python code example
Example 1: join two dictionaries python
z = {**x, **y}
Example 2: concatenate two dictionnaries python
d1.update(d2)
Example 3: python concatenate dictionaries
# list_of_dictionaries contains a generic number of dictionaries
# having the same type of keys (str, int etc.) and type of values
global_dict = {}
for single_dict in list_of_dictionaries:
global_dict.update(single_dict)
Example 4: concat dicts python
d1={1:2,3:4}; d2={5:6,7:9}; d3={10:8,13:22}
d4 = dict(d1, **d2); d4.update(d3)