问题:怎么样在两个字典中找相同点

answer

    eg1:

        下面2个字典

        a={'x':1,'y':2,'z':3},    b={'w':10,'x':11,'y':2},   

        1)找相同点: a.keys & b.keys()

   2)Find keys in a that are not in b: a.keys()-b.keys()

   3)过滤字典元素:c={key:a[key] for key in a.keys()-{'z','w'}}

           

相关文章:

  • 2022-03-04
  • 2022-02-19
  • 2021-11-26
  • 2022-02-22
  • 2021-06-06
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-08-25
  • 2021-08-31
  • 2021-10-16
  • 2021-09-14
  • 2021-09-10
  • 2021-09-27
相关资源
相似解决方案