Python 2 to Python 3 conversion | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Python 2 to Python 3 conversion

This isn't a question, but in my research I read that many people don't know that you can auto convert your code from Python2 to 3. The process is built into Python3 and is called 2to3. Using $ 2to3 -w example.py in the command line will update your code. Without the -w you'll just be shown the difference without it overwriting the file. This will be useful when you borrow code from somewhere else, like Github, but it's older. Here's the Python directory: https://docs.python.org/3/library/2to3.html

17th Sep 2021, 2:20 PM
Kevin
1 Answer
+ 1
That's usefull, thanks for letting us know
17th Sep 2021, 9:02 PM
Einhorn
Einhorn - avatar