1. 程式人生 > >pythonchallenge闖關 第6題

pythonchallenge闖關 第6題

txt zip comment span imp lec swe rom channel

6、Hint:(1)<!-- <-- zip -->

試著把URL後綴.html改為.zip

發現可以下載

zip文件最後有一個readme.txt

Hint:(2)start from 90052

  (3)answer is inside the zip

打開90052 發現類似於第四題 不過一個是網頁一個是文件

技術分享
import zipfile
import re

z = zipfile.ZipFile(channel.zip, mode=r)

filecontent = z.read(90052.txt)

filecontent = filecontent.decode(
utf-8) print(filecontent)
(6.1)

跳轉到最後的文件內容是:Collect the comments.

技術分享
import zipfile
import re

z = zipfile.ZipFile(channel.zip, mode=r)

filecontent = z.read(90052.txt)

filecontent = filecontent.decode(utf-8)

print(filecontent)

l = [z.getinfo(90052.txt).comment.decode(utf-8)]

filenameprev 
= re.findall(r[0-9], filecontent) while len(filenameprev) != 0: filename = ‘‘.join(filenameprev) +.txt filecontent = z.read(filename).decode(utf-8) print(filecontent) l.append(z.getinfo(filename).comment.decode(utf-8)) filenameprev = re.findall(r[0-9], filecontent) print
(‘‘.join(l))
(6.2)

最後顯示的是由O,X,Y,G,E,N和*組成的HOCKEY

替換URL為oxygen進入下一題

pythonchallenge闖關 第6題