You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Server.py 546B

123456789101112131415161718192021
  1. import http.server
  2. class EigenerHandler(http.server.BaseHTTPRequestHandler):
  3. def do_GET(self):
  4. self.send_response(200)
  5. self.end_headers()
  6. if(self.path == "/Yang.htlm"):
  7. with open("Yang.html", "r") as f:
  8. msg = f.read()
  9. else:
  10. with open("Ying.html", "r") as f:
  11. msg = f.read()
  12. self.wfile.write(msg.encode('utf-8'))
  13. port = 12345
  14. handler = EigenerHandler
  15. address = ('', port)
  16. server = http.server.HTTPServer(address, handler)
  17. server.serve_forever()