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

Python Mega Course: Learn Python in 60 Days, Build 20 Apps
Learn Python on Udemy completely in 60 days or less by building 20 real-world applications from web development to data science.