Small changed, using range() instead of deprecated xrange()

This commit is contained in:
Shuge Lee 2013-01-16 11:05:50 +08:00
parent 03c5242269
commit acdda34589
3 changed files with 7 additions and 7 deletions

View File

@ -6,7 +6,7 @@ how to run
[ -d image_resources ] || mkdir image_resources
wget http://upload.wikimedia.org/wikipedia/commons/6/69/Captcha.jpg -O image_resources/captcha.jpg
python crop/croip.py
python crop/crop.py
## Build it on Mac OS X 10.6.*

View File

@ -22,8 +22,8 @@ def print_im(im, w=None, h=None):
else:
pixels = im
for x in xrange(w):
for y in xrange(h):
for x in range(w):
for y in range(h):
if pixels[x, y] > 128:
print " ",

View File

@ -23,8 +23,8 @@ im = im.draft("L", im.size)
pixsels = im.load()
for x in xrange(w):
for y in xrange(h):
for x in range(w):
for y in range(h):
if pixsels[x, y] > 128:
pixsels[x, y] = WHITE
else:
@ -32,8 +32,8 @@ for x in xrange(w):
counts = []
for x in xrange(w):
count = len([1 for y in xrange(h)
for x in range(w):
count = len([1 for y in range(h)
if pixsels[x, y] is BLACK])
counts.append(count)