from wsgiref.simple_server import make_server def application(environ, start_response): start_response('200 OK', [('Content-Type', 'text/html')]) return ['<h1>Hello, web!</h1>'.encode()] httpd = make_server("127.0.0.1",8002,application) httpd.serve_forever()
python3 最简单的http服务器
最新推荐文章于 2024-04-27 07:10:48 发布
本文介绍了一个简单的使用Python WSGI模块实现的Web服务器程序。该程序通过定义一个application函数响应HTTP请求,并返回静态HTML内容。服务器监听在127.0.0.1的8002端口上。

5493

被折叠的 条评论
为什么被折叠?



