dict1 = {
key1: value1,
key2: value2,
key3: value3
}
dict2 = {
key1: value1,
key4: value4,
key3: value2
}
fdict = {}
when I compare the above two dictionaries, I want to store key1: value1 to fdict dictionary:
my attempt:
for key in dict1.keys():
if key in dict2.keys():
if dict1[key] == dict2[key]:
fdict[key] == dict1[key]
I am having "key error" when I tried above method.. any suggestions?