Reuven M. Lerner @lernerpython.com · 15d

Merge two #Python dicts with | which returns a new dict. Conflicts? The right-side dict gets priority: d1 = {'a':10, 'b':20, 'c':30} d2 = {'b':100, 'c':200, 'd':300} d1 | d2 # {'a': 10, 'b': 100, 'c': 200, 'd': 300} d2 | d1 # {'b': 20, 'c': 30, 'd': 300, 'a': 10}

3 likes 0 replies

?