Two dictionaries i'm using have the same key. They have lists as value. So example
a={'Q':[0, 0, 0], 'T'=[6, 0, 0, 0]......}
b={'Q':[0, 0], 'T'=[0, 6, 0, 0]........}
I have to check how many values match out of the two. I did this
def shared_keyvals(dict1, dict2):
return dict( (key, dict1[key])
for key in (set(dict1) & set(dict2))
if dict1[key] == dict2[key]
)
but it does not compare T=[6,0,0,0] same as T=[0,6,0,0].
So ultimately I want to calculate the no.values b got same as a. So for this example no.of values same of a and b would be 6 (out of 7)