I have two python dictionaries:
dictA = {('a','b') : 1,('a','c') : 3,('b','c') : 1}
dictB = {('b','a') : 4,('a','d') : 6,('b','c') : 2}
I want to compare the keys of dictA and dictB for common keys. I have tried
comm = set(dictA.keys()) & set(dictB.keys())
But, this will only return ('b','c')
.
But,in my case, first key in both the dictionaries are same i.e. dictA[('a','b')]
is equivalent to dictB[('b','a')]
. How to do this ??