在 python x,y 数组中识别 x,y 坐标对

identify x,y coordinate pair in a python x,y array

如何在一个多坐标数组中识别一对坐标 (x1,y1) 的存在与否?例如,在某种代码中:

myCoord = [1,2]

someCoords1 = [[2,3][4,5][1,2][6,7]]
someCoords2 = [[2,3][4,5][8,9][6,7]]

myCoord in someCoords1
True

myCoord in someCoords2
False

我一直在试验 any() 但语法不正确或者方法不正确。 谢谢

使用or operator:

>>> myCoord = [1,2]
>>> someCoords1 = [[2,3], [4,5], [1,2], [6,7]]
>>> someCoords2 = [[2,3], [4,5], [8,9], [6,7]]
>>> myCoord in someCoords1 or myCoord in someCoords2
True

或使用any with generator expression:

>>> any(myCoord in x for x in (someCoords1, someCoords2))
True