1list1 = [1,2,3,4,5,6]
2list2 = [3, 5, 7, 9]
3list(set(list1).intersection(list2))
1list1 = ['little','blue','widget']
2list2 = ['there','is','a','little','blue','cup','on','the','table']
3
4list3 = set(list1)&set(list2)
5
6list4 = sorted(list3, key = lambda k : list1.index(k))
1# using numpy
2import numpy as np
3a = np.array([1,2,3,2,3,4,3,4,5,6])
4b = np.array([7,2,10,2,7,4,9,4,9,8])
5# using intersect1d
6print(np.intersect1d(a,b))
7# output
8# [2 4]
1>>> p = [[1,2,3], [1,9,9], [1,2,4]]
2>>> set.intersection(*map(set, p))
3set([1])
4>>> ip = iter(p)
5>>> s = set(next(ip))
6>>> s.intersection(*ip)
7set([1])
8