I have searched the previous posts and have not found one where the person asking is doing quite what I'm trying to do:
I am trying to look through two separate dictionaries and find instances where the keys are the same, but the values are different. The dictionaries are not the same size. When I find matching keys that have different values, I want to add just the keys to a list as I will not need the values anymore.
Right now I am doing this. It is horribly inefficient, but is ok for 200-ish items. I have some dictionaries that are over 200,000 items, though, and that is where this becomes a major problem:
for sourceKey, sourceValue in sourceDict.iteritems():
for targetKey, targetValue in targetDict.iteritems():
if targetKey == sourceKey:
if targetValue != sourceValue:
diffList.append(sourceKey)
Is there a way to do this at all? I am using Python 2.6.