This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# compare two dictionaries and return which items have different values | |
def dict_diff(dict1, dict2): | |
diff = {} | |
keys_d1 = dict1.keys() | |
keys_d2 = dict2.keys() | |
for key_d1 in keys_d1: | |
if key_d1 in keys_d2: | |
if dict1[key_d1] != dict2[key_d1]: | |
diff[key_d1] = (dict1[key_d1], dict2[key_d1]) | |
else: |