pythonchallenge闖關 第6題
阿新 • • 發佈:2017-10-01
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(‘(6.1)utf-8‘) print(filecontent)
跳轉到最後的文件內容是: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(6.2)= 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))
最後顯示的是由O,X,Y,G,E,N和*組成的HOCKEY
替換URL為oxygen進入下一題
pythonchallenge闖關 第6題