亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何啟動http服務器,然后打開Web瀏覽器?

如何啟動http服務器,然后打開Web瀏覽器?

米琪卡哇伊 2021-03-19 18:15:30
我正在嘗試: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瀏覽器行,則瀏覽器將不會停止打開新窗口。為什么?我仍然不太了解多處理模塊,但是這樣的事情應該很簡單。這是怎么做的?
查看完整描述

2 回答

  • 2 回答
  • 0 關注
  • 396 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號