标签:
有了这块知识,应该对各类WEB框架有更好的理解吧。。FLASK,DJANGO,WEBPY。。。。
#!/usr/bin/env python from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler class RequestHandler(BaseHTTPRequestHandler): def _writeheaders(self): self.send_response(200) self.send_header(‘Content-type‘, ‘text/html‘) self.end_headers() def do_HEAD(self): self._writeheaders() def do_GET(self): self._writeheaders() self.wfile.write(""" <HTML><HEAD><TITLE>sample python page</TITLE></HEAD> <BODY> THIS IS A SAMPLE PAGE. </BODY></HTML>""") serveraddr = (‘‘,8765) srvr = HTTPServer(serveraddr, RequestHandler) srvr.serve_forever()
深入了解一下PYTHON中关于SOCKETSERVER的模块-A
标签:
原文地址:http://www.cnblogs.com/aguncn/p/4812235.html