Python comes with method: a sentence of code to start an http service

Environmental preparation

  • linux
  • Windows with python installed (environment variables are configured)

Start command

1. Python version is less than 3.0

python -m SimpleHTTPServer 8080
  • -m means run the python module as a script
  • Start port is configured to 8080

2. The python version is equal to or higher than 3.0

python -m http.server 8080

END

Published 148 original articles · Like 59 · Visits 350,000+

Guess you like

Origin blog.csdn.net/momDIY/article/details/105525217