>>> a = [1,2,3]
>>> b = [2,4,5]
>>> list(set(a).intersection(set(b)))
[2]
>>> list(set(a).union(set(b)))
[1, 2, 3, 4, 5]
>>> list(set(a).difference(set(b)))
[1, 3]
>>> list(set(b).difference(set(a)))
[4, 5]
>>>

相关文章:

  • 2021-06-03
  • 2021-08-02
  • 2022-12-23
  • 2022-12-23
  • 2021-12-01
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-25
  • 2021-12-14
  • 2022-02-11
  • 2022-02-24
  • 2022-12-23
  • 2021-06-30
相关资源
相似解决方案