python open http service

Official documentation example. 

import http.server
import socketserver

port=8000
handl=http.server.SimpleHTTPRequestHandler

with socketserver.TCPServer(('127.0.0.1',port),handl) as httpd:
    print('sering st port',port)
    httpd.serve_forever()

As shown in the figure, if there is index.html in it, the index.html page will be displayed directly

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325252336&siteId=291194637