the python challenge_python challenge 6

hint1: start from 90052

hint2: answer is inside the zip

打开90052.txt,内容是Next nothing is 94191,看来这题是跟第四题一样,找next nothing。同时要用到对ZIP的处理。 准备编程,将下载下来的channel.zip保存到本地环境。

import zipfile

import re

if __name__ == '__main__':

z = zipfile.ZipFile('channel.zip', mode='r')

prefix = '90052'

surfix = '.txt'

findNothing = re.compile('Next nothing is (\d*)').search

while True:

text = z.read(prefix + surfix);

print(text)

match = findNothing(text)

if match:

prefix = match.group(1)

else:

break

最后输出一句:Collect the comments.

去哪儿收集comments呢,再次看页面源码,也没什么特殊的comments,会不会是在zip文件里呢? 于是修改代码,使用ZipInfo类获取comment:

import zipfile

import re

if __name__ == '__main__':

z = zipfile.ZipFile('channel.zip', mode='r')

prefix = '90052'

surfix = '.txt'

findNothing = re.compile('Next nothing is (\d*)').search

comments = []

while True:

text = z.read(prefix + surfix);

print(text)

match = findNothing(text)

if match:

prefix = match.group(1)

comments.append(z.getinfo(prefix + surfix).comment)

else:

break

print(''.join(comments))

最后打印出:

***************************************************************

****************************************************************

**                                                            **

**   OO    OO    XX      YYYY    GG    GG  EEEEEE NN      NN  **

**   OO    OO  XXXXXX   YYYYYY   GG   GG   EEEEEE  NN    NN   **

**   OO    OO XXX  XXX YYY   YY  GG GG     EE       NN  NN    **

**   OOOOOOOO XX    XX YY        GGG       EEEEE     NNNN     **

**   OOOOOOOO XX    XX YY        GGG       EEEEE      NN      **

**   OO    OO XXX  XXX YYY   YY  GG GG     EE         NN      **

**   OO    OO  XXXXXX   YYYYYY   GG   GG   EEEEEE     NN      **

**   OO    OO    XX      YYYY    GG    GG  EEEEEE     NN      **

**                                                            **

****************************************************************

**************************************************************

出来这个结果很惊讶,原来comment中包含有换行符,开始还以为会出一行长串字符呢。

HOCKEY应该就是过关答案了。

将hockey应用到url上,出现it's in the air. look at the letters. 原来还有个小关卡。这下晕了,开始以为是文字游戏,答案在“air”中,于是试了a,i,r三个字母的每种排列,无效,实在没办法了,上网找线索…………  原来,答案是oxygen,你能猜到吗?

(oxygen就是组成HOCKEY的小字母)

把oxygen应用到url上,过关。

通过这一题,学习到了zipfile的简单使用。

0

0

分享到:

18e900b8666ce6f233d25ec02f95ee59.png

72dd548719f0ace4d5f9bca64e1d7715.png

2009-12-29 16:05

浏览 5405

评论

1 楼

plmxsyuts6

2012-03-03

it's in the air. look at the letters.

答案oxygen氧气,不是

(oxygen就是组成HOCKEY的小字母)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值