第六关地址
http://www.pythonchallenge.com/pc/def/channel.html
和前几关一样,首先看网页源码吧。反正不看也没办法。。。
<html><!-- <-- zip --><head>
<title>now there are pairs</title>
<link rel="stylesheet" type="text/css" href="../style.css">
</head>
<body>
<center>
<img src="channel.jpg">
<br>
<!-- The following has nothing to do with the riddle itself. I just
thought it would be the right point to offer you to donate to the
Python Challenge project. Any amount will be greatly appreciated. -thesamet
--> <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="thesamet@gmail.com">
<input type="hidden" name="item_name" value="Python Challenge donations">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="tax" value="0">
<input type="hidden" name="bn" value="PP-DonationsBF">
<input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but04.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form> </center></body></html>
有用的信息 zip。<!--内容-->翻译是。 以下与谜题本身无关。。。
所以有用的只有一个zip。一开始以为zip是一个网页,后来发现是把
http://www.pythonchallenge.com/pc/def/channel.html
变换成
http://www.pythonchallenge.com/pc/def/channel.zip
得到一个zip压缩文件。
使用python代码解压。(压缩包解压也可以)
#-*- coding:utf-8 -*-
#代码版本均为python 3.5.1
#Level 6 import zipfile
import os
import glob file = zipfile.ZipFile("channel.zip", "r") print ('''列出文件''')
for name in file.namelist():
print(name) print ('''列出文件信息''')
for info in file.infolist():
print (info.filename,"文件名")
print (info.date_time,"修改时间")
print (info.file_size,"大小")
print (info.compress_type,"压缩级别")
print (info.compress_size ,"压缩数据大小")
print (info.file_size,"未压缩文件大小") for i in range(1, 10):
print ("") print ('''解压操作 unzip''')
for name in file.namelist():
file.extract(name,os.getcwd()+"/zipfile_module") #解压到当前目录 #关闭压缩文件句柄
file.close
和之前的一关有点相似。跑了一遍代码。发现提示说答案在压缩文件注释中。
关于python压缩文件.
http://www.jb51.net/article/68417.htm
最终代码
#-*- coding:utf-8 -*-
#代码版本均为python 3.5.1
#Level 6 import zipfile
import os
import glob
import re file = zipfile.ZipFile("channel.zip", "r") p = 90052 for name in file.namelist():
line = str(file.read("%s.txt" % p))
m = re.search('Next nothing is ([0-9]+)', line)
print (file.getinfo("%s.txt" % p).comment.decode("utf-8"), end=" ")
p = m.group(1)
下一关地址。
http://www.pythonchallenge.com/pc/def/oxygen.html