📌  相关文章
📜  python 检查列表是否包含另一个列表的元素 - Python 代码示例

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

代码示例6
## using set
list_A = [1, 2, 3, 4]
list_B = [5,1]

set_A = set(list_A)
set_B = set(list_B)

output = False if (set_A.intersection(set_B) == set()) else True
print(output)
# True if there is any element same
# False if there is no element same