python挑战之level 30
2016-10-03 23:29
281 查看
连接为: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高的图像。显示出了一个方程。
使用方程: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
密码:(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挑战之level 11
- python挑战之level 14
- python挑战之level 33
- Python挑战游戏( PythonChallenge)闯关之路Level- 4
- Python挑战游戏( PythonChallenge)闯关之路Level- 3
- pythontip 挑战python 21-30 题解
- python挑战之level 31
- python挑战之level 29
- Python挑战游戏( PythonChallenge)闯关之路Level- 6
- python挑战之level 15
- python挑战之level 22
- python挑战之level 20+21
- python挑战之level 32
- python挑战之level 26
- python挑战之level 12
- python挑战之level 19
- python挑战之level 24
- Python挑战游戏( PythonChallenge)闯关之路Level- 1
- python挑战之level 28
- Python挑战游戏( PythonChallenge)闯关之路Level 0