Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to convert Python 3 to Python 2 code? [closed]

I had written a program in Python 3, but now want to convert it into Python 2 code. Are there any utilities to do that automatically?

like image 805
Roger Travis Avatar asked Mar 28 '10 14:03

Roger Travis


People also ask

Does code Python 2 work with Python 3?

2to3. The original recommended answer was to use 2to3, a tool that can automatically convert Python 2 code to Python 3 code, or guide you in doing so. If you want your code to work in both, you need to deliver Python 2 code, then run 2to3 at installation time to port it to Python 3.

Is Python 3 backwards compatible with Python 2?

Python 3 is not backwards compatible with Python 2, so your code may need to be adapted. Please start migrating your existing your existing Python 2 code to Python 3. Python 2 series End Of Life is set to 1st of January 2020.


1 Answers

You want 3to2 for that.

like image 196
Ignacio Vazquez-Abrams Avatar answered Oct 13 '22 23:10

Ignacio Vazquez-Abrams