How to compare only the values of two dictonaries?
So I have this:
dict1 = {"appe": 3962.00, "waspeen": 3304.08}
dic2 = {"appel": 3962.00, "waspeen": 3304.08}
def compare_value_dict(dic):
return dic
def compare_value_dict2(dic2):
return dic2
def compare_dic(dic1, dic2):
if dic1 == dic2:
print('the same dictionary')
else:
print('difference dictionary')
compare_dic(compare_value_dict(dict1).values(), compare_value_dict2(dic2.values()))
this works:
compare_dic(compare_value_dict(dict1).keys(), compare_value_dict2(dic2.keys()))
you can go with the function dic.keys() that returns a vector containing all "headers" from your dictionary. And in the for loop, you can compare.