📜  列表中的交集 - Python 代码示例

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

代码示例1
def intersection(lst1, lst2): 
    lst3 = [value for value in lst1 if value in lst2] 
    return lst3 
  
# Driver Code 
lst1 = [4, 9, 1, 17, 11, 26, 28, 54, 69] 
lst2 = [9, 9, 74, 21, 45, 11, 63, 28, 26] 
print(intersection(lst1, lst2))