W3docs

What is the Python 3 equivalent of "python -m SimpleHTTPServer"

In Python 3, you can use the http.server module to run a simple HTTP server.

In Python 3, you can use the http.server module to run a simple HTTP server. To start a server, you can use the following command:

Use the http.server module in Python to run a simple HTTP serverr

python -m http.server

This will start the server on port 8000. If you want to specify a different port, you can pass it as an argument to the http.server module, like this:

Start a simple HTTP server on a special port in Python

python -m http.server 8080

This will start the server on port 8080.

You can also specify the directory from which to serve files using the --directory or -d option. For example:

A simple file server in Python

python -m http.server --directory /path/to/directory

This will start the server and serve files from the specified directory.