Back
Can someone tell me a python -m SimpleHTTPServer equivalent Python 3?
For Python 3 use the command:
python3 -m http.server
Check Python help docs for more or comment down below.
By using 2to3 utility:-
$ cat try.pyimport SimpleHTTPServer$ 2to3 try.pyRefactoringTool: Skipping implicit fixer: bufferRefactoringTool: Skipping implicit fixer: idiomsRefactoringTool: Skipping implicit fixer: set_literalRefactoringTool: Skipping implicit fixer: ws_commaRefactoringTool: Refactored try.py--- try.py (original)+++ try.py (refactored)@@ -1 +1 @@-import SimpleHTTPServer+import http.serverRefactoringTool: Files that need to be modified:RefactoringTool: try.py
$ cat try.py
import SimpleHTTPServer
$ 2to3 try.py
RefactoringTool: Skipping implicit fixer: buffer
RefactoringTool: Skipping implicit fixer: idioms
RefactoringTool: Skipping implicit fixer: set_literal
RefactoringTool: Skipping implicit fixer: ws_comma
RefactoringTool: Refactored try.py
--- try.py (original)
+++ try.py (refactored)
@@ -1 +1 @@
-import SimpleHTTPServer
+import http.server
RefactoringTool: Files that need to be modified:
RefactoringTool: try.py
You can use the following video tutorials to clear all your doubts:-
If you are looking for upskilling yourself in python you can join our Python Training and learn from the industry expert.
31k questions
32.8k answers
501 comments
693 users