+1 vote
2 views
in Python by (2.6k points)
edited by

Can someone tell me a python -m SimpleHTTPServer equivalent Python 3?

2 Answers

0 votes
by (2k points)
edited by

For Python 3 use the command:

python3 -m http.server

Check Python help docs for more or comment down below.

0 votes
ago by (52.8k points)

By using 2to3 utility:-

$ 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:-

...