- Visit the source page, and just see "zip" is useful
- http://www.pythonchallenge.com/pc/def/channel.zip -> get a zip file
- Unzip the file, you will know that it is just like challenge level 4. According the readme.txt, you should start from 90052
- Find "Collect the comment." in 46145.txt
- Modify the python code to collect the comments of the zipped files.
import re
import zipfile
filename = "channel/%s.txt"
filename_2 = "%s.txt"
var = 90052
content = ''
pattern = re.compile("Next nothing is ([0-9]+)")
re_result = []
zip_file = zipfile.ZipFile("channel.zip")
comments = ''
while True:
f = open(filename % str(var))
content = f.read()
f.close()
re_result = re.findall(pattern, content)
if len(re_result) == 0:
print var, content
break
else:
var = ''.join(re_result)
comments = comments + zip_file.getinfo(filename_2 % str(var)).comment
print comments
- The result shows:
- Firstly, I thought the answer would be "hockey", but indeed it is "oxygen".
沒有留言:
張貼留言