PythonChallenge 挑战之路 Level-6

来源:互联网 发布:ubuntu怎么安装jdk 编辑:程序博客网 时间:2024/05/01 22:04
这一关的提示基本没有,网页源码只有一句一开始被忽视的提示:
<!-- <-- zip -->

用zip替换channel后,只有一句话:yes. find the zip.

可是去哪去找zip呢?没办法,上网搜了一下才知道,原来是用zip替换html(http://www.pythonchallenge.com/pc/def/channel.zip),坑爹啊。这样可以下载一个.zip文件,里面包含了很多的XXXX.txt文件,以及一个readme,看了一下,大致意思和Level-4的问题一样,不过是要用zipfile模块来读文件,稍微修改一下代码,最后的结果是:

Collect the comments.

那么注释又再什么地方呢?再上网搜,原来.zip中的每个文件都包含注释……再修改代码:

import zipfileimport refile = zipfile.ZipFile('channel.zip','r')txtfile = '%s.txt'nothing = 90052output = open('output6.txt','w')while 1>0:    text = file.read(txtfile % nothing)    a = re.findall(r'(\d+)',text)    print text     output.write(file.getinfo(txtfile % nothing).comment)    if a == []:        break    nothing = a[len(a)-1]output.close()
结果为:


用HOCKEY替换网址,又出现一句提示:

it's in the air. look at the letters. 它在空气中,看看那些字母。)

所以结果就是:OXYGEN(氧气,就是上图中每一行中的字母)

再替换一次,过关:)



原创粉丝点击