Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
+1 vote
3 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
by (106k points)
edited by

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

If you are looking for upskilling yourself in python you can join our Python Training and learn from the industry expert.

Related questions

0 votes
1 answer
+1 vote
2 answers
0 votes
1 answer
0 votes
5 answers

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...