Python 2.7 - Show Only Modified Dictionary Key/value While Comparing Dictionaries
Trying to compare two dictionaries with this code: def dict_compare(d1, d2): d1_keys = set(d1.keys()) d2_keys = set(d2.keys()) intersect_keys = d1_keys.intersection(d2_
Solution 1:
You should compare the list with the actual values with a bitwise exclusive or (^
):
differences = set(one["1iG5NDGVre"]["118"]) ^ set(two["1iG5NDGVre"]["118"])
print differences
Post a Comment for "Python 2.7 - Show Only Modified Dictionary Key/value While Comparing Dictionaries"