2to3 is a tool for automated Python 2 to 3 code translation. Don't use this tag to ask about differences between Python 2 and Python 3. Use the [python-3.x] and [python-2.7] tags for that.
2to3
is a Python program that reads Python 2.x source code and applies a series of fixers to transform it into valid Python 3.x code. The standard library contains a rich set of fixers that will handle almost all code.2to3
supporting librarylib2to3
is, however, a flexible and generic library, so it is possible to write your own fixers for2to3
.lib2to3
could also be adapted to custom applications in which Python code needs to be edited automatically.
For more information, see the documentation at: http://docs.python.org/library/2to3.html