This might be obvious to others.
Using a > 10
breaks the loop
as expected, however a == 10
doesn't. Why is this happening? I am using Python 3.5
.
The code snippet:
from PIL import Image
im = Image.open('1.jpg')
px = im.load()
width, height = im.size
for a in range(width):
for b in range(height):
if a == 10:
break
print(a, b)
Edit: I trying to stop the iteration when the image width has reached 10. The output looks like this:
...
9 477
9 478
9 479
10 0
10 1
10 2
10 3
...