I have found multiple posts (this one too) that was about this topic but none of those options would work for my dictionaries. I wanna compare my dictionnaries and know the number of values identical and also the pair of key-values unique to each dictionaries.
I am working with two dictionaries with Tuples as key and list as value (where the second value is another list) as follow:
Dict1:{(10, 11): ['C', ['T']],
(20, 21): ['C', ['T']],
(34, 35): ['G', ['A']],
(68, 69): ['A', ['T','G']]}
Dict2:{(10, 11): ['C', ['T']],
(20, 21): ['C', ['A']],
(40, 41): ['T', ['G']],
(68, 69): ['A', ['T','G']]}
and I would like to compare those dictionnary and have different output. Using my example that's the variable I would like to have:
- 2 values are identical and present in both dict
- 2 values are only in dict1
- 2 values are only in dict2
I was about to loop over dict1 and compare each key to all dict2 each time (and having variables that i'll updates each time a condition is met) but I am aware that it is probably not the most efficient way of doing it.
Does anyone have a quicker idea ?
Thanks