I can use diff = set(dict2) - set(dict1)
to know that the dict1
and dict2
are not equal but what I need is to find which KEY in dict2
has a different value than dict1
dict1 = {'c1': 'Iran', 'c2': 'India', 'c3': 'Iraq', 'c4': 'Qatar'}
dict2 = {'c1': 'Iran', 'c2': 'India', 'c3': 'Iraqs','c4': 'Qeter'}
diff = set(dict2) - set(dict1)
print(diff)
Basically what I want to get in return are {'c3', 'c4'}