1.代码
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # __author henry # __date 2018/11/4 from wsgiref.simple_server import make_server def application(environ, start_response): start_response('200 ok', [('Content-Type', 'text/html')]) return [b'<h1>hello, web!</h1>'] httpd = make_server('', 8080, application) print('serving Http oN port 8000...') # 开始监听HTTP请求 httpd.serve_forever()
2. 执行 run
3.浏览器响应