标签:ade main python com png code tps cst send
1.代码:
from http.server import HTTPServer, BaseHTTPRequestHandler class Handler(BaseHTTPRequestHandler): """docstring fos Handler""" def do_sth_for_GET(self): self.send_response(200) self.send_header(‘Content_type‘,‘text/plain;charset=utf-8‘) self.end_header() self.wfile.write(‘Hello everyone,I am William,I am a AI server~\n‘.encode()) if __name__==‘__main__‘: server_address=(‘‘,9999) httpd=HTTPServer(server_address,Handler) httpd.serve_forever()
2.网址中输入:127.0.0.1:9999(或者localhost:9999)
3.报错:
标签:ade main python com png code tps cst send
原文地址:https://www.cnblogs.com/jpr-ok/p/12658677.html