Python one line of code to create HTTP Server

The differences between Python2 and Python3 are:

Python2.x

The following code binds 8000the port as the listening port

$ python -m SimpleHTTPServer 8000

Python3.x

The following code binds 8000the port as the listening port and binds all interfaces by default.

$ python3 -m http.server 8000

If you want to bind a specific interface, such as local link loopback, you can add --bindparameters

$ python3 -m http.server 8000 --bind 127.0.0.1

Guess you like

Origin blog.csdn.net/gongchenyu/article/details/123739752