← All tips Python: merge dicts with | (3.9+) pythonbasics Use the union operator for shallow merges. a = {'x': 1} b = {'y': 2} print(a | b)