dict_1 = {'a':1,'b':2}
dict_2 = {'a':1,'b':3}
diff_items = {k: dict_2 [k] for k in dict_1.keys() & dict_2 .keys() if dict_1[k] != dict_2 [k]}
输出
{'b':3}
dict_1 = {'a':1,'b':2}
dict_2 = {'a':1,'b':3}
diff_items = {k: dict_2 [k] for k in dict_1.keys() & dict_2 .keys() if dict_1[k] != dict_2 [k]}
输出
{'b':3}