-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path05.py
More file actions
28 lines (20 loc) · 663 Bytes
/
05.py
File metadata and controls
28 lines (20 loc) · 663 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env python3
# http://www.pythonchallenge.com/pc/def/peak.html
import pickle
import signal
from urllib import request
from handlers.python import exit_signal_handler
if __name__ == '__main__':
signal.signal(signal.SIGINT, exit_signal_handler)
try:
s = ""
response = request.urlopen("http://www.pythonchallenge.com/pc/def/banner.p")
data = pickle.load(response)
response.close()
for ld in data: # data composed of lists
for t in ld: # lists composed by tuples
s = f"{s}{t[1]*t[0]}"
s = f"{s}\n"
print(s)
except Exception as e:
print(e)