Python 3.x BaseHTTPServer or http.server

后端 未结 4 1071
一向
一向 2021-01-30 12:26

I am trying to make a BaseHTTPServer program. I prefer to use Python 3.3 or 3.2 for it. I find the doc hard to understand regarding what to import but tried changing the import

4条回答
  •  悲&欢浪女
    2021-01-30 13:17

    You can just do like that:

    self.send_header('Content-type','text/html'.encode())
    self.end_headers()
    # Send the html message
    self.wfile.write("Hello World !".encode())
    

提交回复
热议问题