pythonchallenge Level 6

2021/12/7 11:21:15

本文主要是介绍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



这篇关于pythonchallenge Level 6的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程