the-honk/python/pythonchallenge.com/6 - Channel.py

17 lines
401 B
Python
Raw Permalink Normal View History

2024-10-09 17:02:27 +00:00
import zipfile
import re
f = zipfile.ZipFile('channel.zip')
num = '90052'
comments = []
while True:
content = f.read('{0}.txt'.format(num)).decode('utf-8')
comments.append(f.getinfo('{0}.txt'.format(num)).comment.decode('utf-8'))
print(content)
match = re.search('Next nothing is (\d+)', content)
if match == None:
break
num = match.group(1)
print(''.join(comments))