学习了一下python中zipfile模块,先把网址html换为zip,可以得到一个压缩文件
根据提示,不断寻找,直到找到最终的我文件,提示 collect the comments
修改程序,把途中的每个文件的comment都添加到一个string中
代码如下:
import zipfile
import re
import time
z = zipfile.ZipFile('channel.zip','r')
num = '90052'
comments = ''
while(True):
filename = num
print("filename",filename)
filename += '.txt'
print(filename)
content = z.read(filename)
print(content)
numstr = re.search(r'([0-9])+',content)
if numstr:
print(numstr.group())
num = numstr.group()
print(z.getinfo(filename).comment)
comments += z.getinfo(filename).comment
else:
break
print(comments)
得到hockey,进入后提示看每个字母的组成字母, 得到oxygen即到下一关