我正在尝试:import multiprocessingfrom wsgiref.simple_server import make_serverimport webbrowserimport timedef application(environ, start_response): start_response("200 OK", [("Content-Type", "text/plain")]) return ["Hello!"]class Server(multiprocessing.Process): def run(self): print "HTTP Server starts." server = make_server(host = "127.0.0.1", port = 88, app = application) try: server.serve_forever() except (KeyboardInterrupt, SystemExit): print "HTTP Server stopped." raisehttpd = Server()httpd.start()#webbrowser.open("http://127.0.0.1:88")time.sleep(3)httpd.terminate()httpd.join()print "End"如果我取消注释Web浏览器行,则浏览器将不会停止打开新窗口。为什么?我仍然不太了解多处理模块,但是这样的事情应该很简单。这是怎么做的?
添加回答
举报
0/150
提交
取消