Finding matching keys in two large dictionaries and doing it fast

前端 未结 11 1680
鱼传尺愫
鱼传尺愫 2020-12-15 17:35

I am trying to find corresponding keys in two different dictionaries. Each has about 600k entries.

Say for example:

    myRDP = { \'Actinobacter\':          


        
11条回答
  •  孤城傲影
    2020-12-15 18:13

    You can simply write this code and it will save the common key in a list. common = [i for i in myRDP.keys() if i in myNames.keys()]

提交回复
热议问题