efficiently knowing if intersection of two list is empty or not, in python [duplicate]
问题 This question already has answers here : Test if lists share any items in python (9 answers) Closed 3 years ago . Suppose I have two lists, L and M. Now I want to know if they share an element. Which would be the fastest way of asking (in python) if they share an element? I don't care which elements they share, or how many, just if they share or not. For example, in this case L = [1,2,3,4,5,6] M = [8,9,10] I should get False, and here: L = [1,2,3,4,5,6] M = [5,6,7] I should get True. I hope