Break indentation for nested loop
This question already has an answer here:
考虑将代码放入一个函数中,并使用return语句打破所有循环。
def func():
im1 = Image.open("C:UsersPoosDesktopGgreen_pixel.bmp")
A = list(im1.getdata())
x = 0
y = 0
im2 = ImageGrab.grab()
B = list(im2.getdata())
for x in range(0,1024, 50):
for y in range(0,600, 20):
if(B != A):
im3 = im2.crop((x,y,x+1,y+1))
B = list(im3.getdata())
print(x, y)
else:
print("hooray!")
return
return
链接地址: http://www.djcxy.com/p/36326.html
下一篇: 为嵌套循环打破缩进