Python:在数组中设置变量

时间:2017-03-20 17:57:50

标签: python

是否可以将片段数组设置为[x,y]变量。例如,片[[x1,y1],[x2,y2],....]

以下是我的代码:

piece = [[387,500] , [247,499] , [120,496] , [533,488] , [191,432] , [464,432],[328,426] , [50,426]]

if (292<x<350) and (390<y<450) in piece:
    print("do something")

1 个答案:

答案 0 :(得分:2)

for x, y in piece:
    if (292<x<350) and (390<y<450):
        print("do something")