Skip to content
Snippets Groups Projects
Commit 17640840 authored by Martin Schultz's avatar Martin Schultz
Browse files

Add new file

parents
Branches master
No related tags found
No related merge requests found
xmas.py 0 → 100644
from operator import itemgetter
import http.server
import socketserver
PORT = 8080
Handler = http.server.SimpleHTTPRequestHandler
data = [(5, 32), (15, 33), (6, 67), (0, 77), (13, 97), (1, 101), (7, 104),
(9, 105), (12, 109), (2, 114), (3, 114), (8, 114), (10, 115), (14, 115),
(11, 116), (4, 121)
]
with open('index.html', 'w') as f:
f.write('<HTML><BODY><FONT size="+2" face="verdana" color="green">\n')
for s in range(20, 9, -1):
f.write(f"<p>{s*'&nbsp;&nbsp;'}{(41-2*s)*'^'}</p>\n")
f.write("<p>"+15*"&nbsp;&nbsp;"+"".join([chr(j) for i, j in sorted(data, key=itemgetter(0))])+"</p>\n" )
f.write('</FONT></BODY></HTML>\n')
with socketserver.TCPServer(("", PORT), Handler) as httpd:
print(f"open http://localhost:{PORT} in your browser")
httpd.serve_forever()
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment