Python开启web服务

2017-11-29  本文已影响43人  李小西033

Python2

# 指定端口号
python -m SimpleHTTPServer 8000

Python3之后 SimpleHTTPServer模块被合并进了http.server,开启web服务命令变更为:

python -m http.server 8000

也可以绑定IP

python -m http.server 8000 --bind 127.0.0.1

https://docs.python.org/2/library/simplehttpserver.html
https://docs.python.org/3.6/library/http.server.html

上一篇 下一篇

猜你喜欢

热点阅读