merge the dict based on key value in dict python code example Example 1: merge two dict python 3 z = {**x, **y} Example 2: concatenate two dictionnaries python d1.update(d2)