pythonchallenge Level 6

Posted OTAKU_undefined

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了pythonchallenge Level 6相关的知识,希望对你有一定的参考价值。

第6关地址:http://www.pythonchallenge.com/pc/def/channel.html

查看源码获得提示信息zip

url改成zip后得到一个channel.zip文件

解压之后是一堆数字命名的txt,以及一个readme.txt

打开readme.txt获得新的提示

welcome to my zipped list.

hint1: start from 90052

hint2: answer is inside the zip

打开90052.txt 获得提示信息:Next nothing is 94191

也就是需要按顺序打开txt文件

import os

def findTxt(num):
    filename = str(num)+".txt"
    f = open(filename)
    info = f.readline()
    num = info.split(" ")[-1]
    if num.isdigit():
        findTxt(num)
    else:
        print(info)

path = os.getcwd()+"\\channel"
os.chdir(path)
findTxt(90052)

运行之后获得新的提示信息:Collect the comments.

也就是要收集comment信息,修改下脚本

import os
import zipfile

orderedFilePath = []
def findTxt(num):
    filename = str(num)+".txt"
    orderedFilePath.append(filename)
    f = open(filename)
    info = f.readline()
    num = info.split(" ")[-1]
    if num.isdigit():
        #print(num)
        findTxt(num)
    else:
        print(info)

path = os.getcwd()+"\\channel"
os.chdir(path)
findTxt(90052)
# 获得提示:Collect the comments.

z = zipfile.ZipFile("channel.zip")
for file in orderedFilePath:
    c = z.getinfo(file).comment.decode()
    print(c,end="")
print("")

打印得到hockey

打开:http://www.pythonchallenge.com/pc/def/hockey.html

获得提示:it\'s in the air. look at the letters.

会发现hockey是由字母组成,oxygen

获得下一关地址:http://www.pythonchallenge.com/pc/def/oxygen.html

本文来自博客园,作者:OTAKU_undefined,转载请注明原文链接:https://www.cnblogs.com/nicole-zhang/p/15557460.html

以上是关于pythonchallenge Level 6的主要内容,如果未能解决你的问题,请参考以下文章

pythonchallenge 解谜 Level 6

pythonchallenge Level 5

pythonchallenge Level 2

pythonchallenge Level 8

pythonchallenge Level 4

pythonchallenge Level 7