pythonchallenge Level 7

Posted OTAKU_undefined

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了pythonchallenge Level 7相关的知识,希望对你有一定的参考价值。

第7关地址:http://www.pythonchallenge.com/pc/def/oxygen.html

发现图片中间有一条灰色的,取出像素点颜色,发现RGB都是一样的。

把R值当成ASCII转成字符,得到一段文本,每个字符重复七次左右

sssssmmmmmmmaaaaaaarrrrrrrttttttt ggggggguuuuuuuyyyyyyy,,,,,,, yyyyyyyooooooouuuuuuu mmmmmmmaaaaaaadddddddeeeeeee iiiiiiittttttt....... ttttttthhhhhhheeeeeee nnnnnnneeeeeeexxxxxxxttttttt llllllleeeeeeevvvvvvveeeeeeelllllll iiiiiiisssssss [[[[[[[111111100000005555555,,,,,,, 111111111111110000000,,,,,,, 111111111111116666666,,,,,,, 111111100000001111111,,,,,,, 111111100000003333333,,,,,,, 111111111111114444444,,,,,,, 111111100000005555555,,,,,,, 111111111111116666666,,,,,,, 111111122222221111111]]]]]]]]

from PIL import Image

im = Image.open("oxygen.png")
(width, height) = im.size
str_x = [""]
for i in range(0,width):
    pos = (i,height/2) # 灰色条在中间位置
    pixel = im.getpixel(pos) # 获取像素点颜色
    str_x.append(chr(pixel[0])) # ascii码转字符

result = "".join(str_x)[::7] # 发现字母重复7次左右,隔7次取一次值
print(result)

隔7次取值,得到提示信息:

smart guy, you made it. the next level is [105, 110, 116, 101, 103, 114, 105, 116, 121]

把 [105, 110, 116, 101, 103, 114, 105, 116, 121]转字符

print(\'\'.join(map(chr,[105, 110, 116, 101, 103, 114, 105, 116, 121])))

得到 integrity

获得下一关地址:http://www.pythonchallenge.com/pc/def/integrity.html

本文来自博客园,作者:OTAKU_undefined,转载请注明原文链接:https://www.cnblogs.com/nicole-zhang/p/15557474.html

以上是关于pythonchallenge Level 7的主要内容,如果未能解决你的问题,请参考以下文章

pythonchallenge Level 5

pythonchallenge Level 2

pythonchallenge Level 8

pythonchallenge Level 4

pythonchallenge Level 3

pythonchallenge Level 6