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.

Ying_Yang 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import http.server
  2. class EigenerHandler(http.server.BaseHTTPRequestHandler):
  3. def do_GET(self):
  4. self.send_response(200)
  5. self.send_header('Content-type', 'text-html')
  6. self.end_headers()
  7. print(self.path)
  8. if self.path=="/ying":
  9. msg = """
  10. <html lang="en">
  11. <head>
  12. <meta charset="UTF-8">
  13. <title>Hier ist "Ying"</title>
  14. </head>
  15. <body>
  16. <a href="/yang"> Wo ist "Yang"? </a>
  17. </body>
  18. </html>
  19. """
  20. else:
  21. msg = """
  22. <html lang="en">
  23. <head>
  24. <meta charset="UTF-8">
  25. <title>Hier ist "Yang"</title>
  26. </head>
  27. <body>
  28. <a href="/ying"> Wo ist "Ying"? </a>
  29. </body>
  30. </html>
  31. """
  32. self.wfile.write(msg.encode('utf-8'))
  33. port = 12345
  34. address = ('', port)
  35. handler = EigenerHandler
  36. server = http.server.HTTPServer(address, handler)
  37. server.serve_forever()