Python: Scal dwie listy słowników
Biorąc pod uwagę dwie listy słowników:
>>> lst1 = [{id: 1, x: "one"},{id: 2, x: "two"}]
>>> lst2 = [{id: 2, x: "two"}, {id: 3, x: "three"}]
>>> merge_lists_of_dicts(lst1, lst2) #merge two lists of dictionary items by the "id" key
[{id: 1, x: "one"}, {id: 2, x: "two"}, {id: 3, x: "three"}]
Jakikolwiek sposób wdrożeniamerge_lists_of_dicts
co łączy dwie listy słownika na podstawie kluczy elementów słownika?