连接为:
http://www.pythonchallenge.com/pc/ring/yankeedoodle.html
密码:(repeat,switch)
推荐视频: #30 relax you are on 30 一波三折
————————————————————————————————————————
标题:relax you are on 30
注释: <!-- while you look at the csv file -->
提示:The picture is only meant to help you relax
——————————————————————————————————————————————————————————
那我们怎么样子解题呢?看注释,提示csv file ,我们改改后缀,结果有一个文件下载下来,这是一个excel.里面很多数据,包含7367个浮点数的文件不知道怎么计算。
百度一下:里面一共有7367个浮点数,7367=139*53,用浮点数*256当灰度画成139宽53高的图像。显示出了一个方程。
<pre name="code" class="python">import re
from PIL import Image
with open('yankeedoodle.csv','r') as f:
text=f.read()
#获取浮点数列表
data=re.findall(r'([.\d+]+)',text)
#采用float*256获得灰度值
databyte=bytearray(int(256*float(i)) for i in data)
#写入图片中
im=Image.new('P',(53,139))
im.putdata(databyte)
#图片是倒置的。所以先旋转,然后在新图片上再颠倒
nim = im.transpose(Image.ROTATE_90)
nim = nim.transpose(Image.FLIP_TOP_BOTTOM)
nim.save('output.png')
使用方程:
s = [chr(int(data[i][5]+data[i+1][5]+data[i+2][6])) for i in range(0,len(data)-2,3)]
print (''.join(s)) 结果为:
So, you found the hidden message.
There is lots of room here for a long message, but we only need very little space to say "look at grandpa", so the rest is just garbage.
但是我的字符串后面多了一大串乱码。不知道怎么回事
下一关为:http://www.pythonchallenge.com/pc/ring/grandpa.html
本文介绍了解决Python挑战中一个谜题的过程,通过解析CSV文件中的7367个浮点数,转换为图像揭示隐藏信息,并进一步解读隐藏文本。


被折叠的 条评论
为什么被折叠?



