Reuven M. Lerner @lernerpython.com · 11d

Want the unique key-value pairs from two #Python dicts? dict.items() returns a set-like object: d1 = {'a':10, 'b':20, 'c':30} d2 = {'b':20, 'c':30, 'd':40} d1.items() | d2.items() This returns the unique key-value pairs: {('b', 20), ('a', 10), ('d', 40), ('c', 30)}

2 likes 0 replies

?