📜  python 查找两个列表的交集 - Python 代码示例

📅  最后修改于: 2022-03-11 14:47:09.439000             🧑  作者: Mango

代码示例5
# intersection of two lists (lst1 & lst2)
In [1]: x = ["a", "b", "c", "d", "e"]

In [2]: y = ["f", "g", "h", "c", "d"]

In [3]: set(x).intersection(y)
Out[3]: {'c', 'd'}
# has_intersection = bool(set(x).intersection(y)) -> True