This is the simplest way to merge or combine two dictionaries in python. This operation in supported in python version above 3.5.

dict_01 = {'p':2, 'q':4}
dict_02 = {'r':6, 's':8}
combined = {**dict_01, **dict_02}
print(combined)

view raw
merge_two_dicts.py
hosted with ❤ by GitHub

 

Sample Output

{'p': 2, 'q': 4, 'r': 6, 's':8}