Simple HTTP server in Python 3.x on specific port

One very cool feature of Python 3.x is instant web server. Type the following command on command line:

The Python will start a simple web server serving content from the working directory at URL: http://localhost:8000.

It’s also possible to specify the port to open, simply add the port number as the next parameter:

The web server by default operates on all network interfaces. It’s possible to restrict which interface to bind by the following command:

This web server will be accessible only from http://192.168.1.10:8080

A similar command is also available for old Python 2.x: