如何在for循环中比较当前索引值和下一个索引值?

我有一个像这样的数组:[[x1,y1,x2,y2),(x1,y1,x2,y2),(x1,y1,x2,y2),(x1,y1,x2,y2)],和我的代码是:

def draw_lines(image, lines, color=[255, 0, 0], thickness=2, make_copy=True):

if make_copy:
    image = np.copy(image) 
cleaned = []

for line in lines:
    for x1,y1,x2,y2 in line:

        if abs(x2-x1) <=10 and abs(y2-y1) >=19 and abs(y2-y1) <= 70 :
            cleaned.append((x1,y1,x2,y2))
            cv2.line(image, (x1, y1), (x2, y2), color, thickness)
print(" No lines detected: ", len(cleaned))
print (cleaned)
return image

在if语句中,我想添加一个新的“ and”条件,该条件将数组当前x1值与数组下一个x1值进行比较。例如:x1 [i + 1] -x1 [i]> 10

在这种情况下,如何使用索引和迭代?

在此先感谢您的帮助!