How to port Python 2 Code to Python 3

autor:

Brett Cannon

Python 2 reached its official end-of-life at the start of 2020. This means that no new bug reports, fixes, or changes will be made to Python 2 - it’s no longer supported: see PEP 373 and status of Python versions.

Se você está pensando wm portar um módulo de extensão em vez de puro código Python, veja Portando módulos de extensão para o Python 3.

The archived python-porting mailing list may contain some useful guidance.

Since Python 3.13 the original porting guide was discontinued. You can find the old guide in the archive.

Third-party guides

There are also multiple third-party guides that might be useful: