pythonchallenge Level 30

第30关地址:http://www.pythonchallenge.com/pc/ring/yankeedoodle.html

用户名:repeat  密码:switch

查看源码

标题:relax you are on 30

提示:The picture is only meant to help you relax

while you look at the csv file

打开:https://www.pythonchallenge.com/pc/ring/yankeedoodle.csv 得到一个下载文件yankeedoodle.csv

from PIL import Image

with open('yankeedoodle.csv') as f:
  data = [d.strip() for d in f.read().split(',')]
  print(len(data)) # 7367

img = Image.new('F',(53,139))
img.putdata([float(d) for d in data],scale=200)
img = img.transpose(Image.FLIP_LEFT_RIGHT) # 左右翻转
img = img.transpose(Image.ROTATE_90) # 转90度
img.save("yankeedoodle.gif")

把数字写入一张图

得到一个公式:n = str(x[i])[5]+str(x[i+1])[5]+str(x[i+2])[6]

继续处理数字,3个一组按照公式计算

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

posted @ 2021-12-07 10:06  OTAKU_nicole  阅读(45)  评论(0编辑  收藏  举报