python challenge 11解题总结

python challenge 11网址:www.pythonchallenge.com/pc/return/5808.html

首先页面的图片很模糊,而且页面源码的标题为odd,even,那么需要对图片进行奇偶坐标的一些处理:

直接把奇列和偶列分开来,显示为两张图片就行了,代码如下:

from PIL import Image
if __name__ == '__main__':   
       
    img = Image.open('cave.jpg')   
       
    w = img.size[0]   
    h = img.size[1]   
       
    odd = even = Image.new(img.mode, (w/2, h/2))   
       
    for x in range(w):   
        for y in range(h):   
            pixel = img.getpixel((x, y))   
            if x % 2 == 0 and y % 2 == 0:   
                odd.putpixel((x/2, y/2), pixel)   
            elif x % 2 == 1 and y % 2 == 0:   
                even.putpixel(((x-1)/2, y/2), pixel)   
            elif x % 2 == 0 and y % 2 == 1:   
                even.putpixel((x/2, (y-1)/2), pixel)   
            elif x % 2 == 1 and y % 2 == 1:   
                odd.putpixel(((x-1)/2, (y-1)/2), pixel)   
                   
    odd.show()   
    even.show() 


结果会显示evil,下一关的网址是:www.pythonchallenge.com/pc/return/evil.html

 

 

如果需要用户名和密码的话,用户名为huge,密码为file。