I am programming a development and I want to compare 2 dictionaries, which in common have keys of the same name.
For example Dictionary 1 is of the form:
dic1 = {'0': [2.4636363650000002], '6': [4.1666666650000002], '9': [4.8333333349999998], '11': [3.5000000090000012], '14': [6.6181818249999989]}
Dictionary 2 is of the form:
dic2 = {'0': [2, 3, 4], '6': [5,6,7], '19': [4.8333333349999998], '10': [4.8333333349999998], '12': [3.5012]}
Upon seeing, the dictionary 2 coincides with the 1 the keys '0' and '6'.
My idea is to create a dictionary 3 that contains only this:
dic3 = {'0': [2, 3, 4], '6': [5,6,7]}
What I am doing is creating lists with the keys of each dictionary, then I compare these lists and in the new dictionary I add those elements of the keys that coincide. I want to know if you know a faster and more efficient way than going through and creating lists, since there are many keys that I have.