import http.server class EingenerHandler(http.server.BaseHTTPRequestHandler): def do_GET(self): self.send_response(200) self.end_headers() if self.path == '/': self.path = '/ying.html' msg = open(self.path[1:]).read() self.wfile.write(bytes(msg, 'utf-8')) Port = 2020 Handler = EingenerHandler address = ('', Port) server = http.server.HTTPServer(address, Handler) server.serve_forever()