Q: How to convert a file from python 2 to python 3?

Python3 2to3 Python

Answer:

Python 3 comes with a great tool to convert python 2 syntaxes to python 3. To convert the file, you simply have to use the command:

2to3 -w yourfile.py

On windows, this tool is usually located in the Tools/scripts folder inside your python installation folder. If you don't have this directory in your environment path. Use the command below.

cd c:\your\python\Tools\scripts\
python 2to3.py -w yourfile.py

    No comments found for this tutorial, be the first to leave a comment!

Answered by
Double

Last updated on
Apr 20, 2017

Share