Finding matching keys in two large dictionaries and doing it fast

前端 未结 11 1678
鱼传尺愫
鱼传尺愫 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:19

    Use the get method instead:

     for key in myRDP:
        value = myNames.get(key)
        if value != None:
          print key, "=", value
    

提交回复
热议问题