What is the Python 3 equivalent of “python -m SimpleHTTPServer”


In Python 3, the http.server module can be used to start a simple HTTP server that serves files from the current directory, similar to the SimpleHTTPServer module in Python 2. The equivalent command to python -m SimpleHTTPServer in Python 3 is:

python3 -m http.server
This will start a server on port 8000 by default, serving files from the current directory. You can also specify a different port number by specifying the port number as an argument:

python3 -m http.server 8080
This will start the server on port 8080 instead of the default port 8000.
Recommended Course

Learn Flask development and learn to build cool apps with our premium Python course on Udemy.