首先下载一个.csv的文件,这是一个包含7367个浮点数的文件,然后就需要利用这些数构成一张图片,而7367=53*139,所以图片为53*139的,利用图片上的信息就可以再一步解码获得谜底了。代码如下:
import Image,re
f = open(r'F:\Python challenge\yankeedoodle.csv','r').read()
data = re.findall(r'(0.\d*)',f)
new = Image.new('F',(53,139))
new.putdata(map(float,data))
new = new.transpose(Image.ROTATE_90)
new = new.transpose(Image.FLIP_TOP_BOTTOM)
new.save(r'F:\Python challenge\out30.tiff')
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.
那么谜底就是grandpa