Solutions for the Python Challenge

Show possible solutions for: All levels; level: previous, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, next

Possible solution for level 7

URI:
http://www.pythonchallenge.com/pc/def/oxygen.html
Log-in data:
Username: ; password:
Comment:
This challenge is the first in a row of (way too many, in my opinion) challenges that require the Python Imaging Library (PIL). If you chose to solve these challenges with Python, that is. I suppose even ImageMagick and a shell script would do the job in some cases.
Possible Solution:
import re, Image

i = Image.open("oxygen.png") # http://www.pythonchallenge.com/pc/def/oxygen.png
row = [i.getpixel((x, 45)) for x in range(0, i.size[0], 7)]
ords = [r for r, g, b, a in row if r == g == b]

print "".join(map(chr, map(int, re.findall("\d+", "".join(map(chr, ords))))))

(Download this source code.)

Code word for next challenge:
integrity

By Holger Thölking, May 29th, 2007.