Last article :[pythonchallenge]-- 0~4 Guan explanation
Hzy The blog of
This level is the same , We have to look at the web source code , You'll find one banner.p link , And then we open up , Found a bunch of symbols , We need to
Deserialization
('', Numbers )
, perhaps ('#', Numbers )
Code :
import requests
import pickle
text = requests.get("http://www.pythonchallenge.com/pc/def/banner.p").content
print(pickle.loads(text))
for list in pickle.loads(text):
print(''.join(l[0] * l[1] for l in list))
# http://www.pythonchallenge.com/pc/def/channel.html
You'll find one channel The characters of
There is only one zipper in this level , Similarly, we open the source code
Prompt us to start from 90052.txt Start , At the same time, the answer is in the compressed package
!Code
import re
first = "90052.txt"
while True:
with open("./channel/" + first, "r") as t:
text = t.readline()
answer = re.findall("\d+", text)
if len(answer) == 1:
first = answer[0] + ".txt"
print("path:{} and text:{}".format(first, text))
else:
print(first)
print(text)
break
# Collect the comments.
import zipfile
first = "90052.txt"
file = zipfile.ZipFile('./channel.zip', 'r')
print(file)
while True:
line = str(file.read("%s" % first))
m = re.search("\d+", line)
print(file.getinfo("%s" % first).comment.decode("utf-8"), end="")
if m is None:
print(file.getinfo("%s" % first).comment.decode("utf-8"))
break
first = m.group(0)+".txt"
Tomorrow, I'll do some questions .