Python Challenge (level 6)

xiaoxiao2026-08-11  2

URI: [url]http://www.pythonchallenge.com/pc/def/channel.html[/url] 说明: title提示是一对。 源代码中出现〈!-- 〈-- zip --〉字样 从http://www.pythonchallenge.com/pc/def/channel.zip 下载zip文件 (提示够变态吧) 打开zip文件中的readme.txt 可以看到 welcome to my zipped list. hint1: start from 90052 hint2: answer is inside the zip 感觉解题思路基本上和上面那个反复调用url的题一样 r=re.compile(r'(\d+)$') nextnothing='90052' while(1): try: f=open('./python challenge/%s.txt' % nextnothing) result=f.read() f.close() print result oldnextnothing=nextnothing nextnothing=r.search(result).group() except: break 执行后最后显示 collect the comments 有点昏吧,哪里来的comments。其实就在zip文件里。这道题最后还是需要用zip模块来完成 import re r=re.compile(r'(\d+)$') import zipfile comment=[] nextnothing='90052' f=zipfile.ZipFile('./python challenge/channel.zip') while(1): try: comment.append(f.getinfo('%s.txt' % nextnothing).comment) nextnothing=r.search(f.read('%s.txt' % nextnothing)).group() except: print ''.join(comment) break 运行屏幕显示一个由字符组成的图片,可以看出图案是HOCKEY 进入http://www.pythonchallenge.com/pc/def/hockey.html 什么?还没结束! 上面显示it's in the air. look at the letters. 此时,再次注意观察前面出现的hockey图片发现,每个字母的图案都是由一个单独的字母组成,得到最终答案oxygey — 解题方法: import urllib, zipfile, re, collectionso, n, f = [], "90052", "%s.txt"nnr = "Next nothing is (\d+)"# 从http://www.pythonchallenge.com/pc/def/channel.zip下载channel.zipfile = zipfile.ZipFile("channel.zip")while True: try: n = re.search(nnr, file.read(f % n)).group(1) except: print file.read(f % n) break o.append(file.getinfo(f % n).comment)print "".join(o) 表面上是HOCKEY,其实正真答案是oxygen 过关答案: oxygen
转载请注明原文地址: https://www.6miu.com/read-5051050.html

最新回复(0)