| CARVIEW |
Select Language
HTTP/2 200
server: nginx
content-type: text/html
last-modified: Sat, 27 Dec 2025 15:28:22 GMT
etag: "694ffb16-3809"
x-clacks-overhead: GNU Terry Pratchett
strict-transport-security: max-age=315360000; includeSubDomains; preload
content-encoding: gzip
via: 1.1 varnish, 1.1 varnish
accept-ranges: bytes
date: Sat, 27 Dec 2025 20:05:37 GMT
age: 3331
x-served-by: cache-lga21982-LGA, cache-bom-vanm7210041-BOM
x-cache: HIT, HIT
x-cache-hits: 27, 1
x-timer: S1766865938.655458,VS0,VE193
vary: Accept-Encoding
content-length: 3594
How to port Python 2 Code to Python 3 — Python 3.14.2 documentation
Navigation
How to port Python 2 Code to Python 3¶
- author:
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.
If you are looking to port an extension module instead of pure Python code, please see Porting Extension Modules to Python 3.
The archived python-porting mailing list may contain some useful guidance.
Since Python 3.11 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:
Navigation
© Copyright 2001 Python Software Foundation.
This page is licensed under the Python Software Foundation License Version 2.
Examples, recipes, and other code in the documentation are additionally licensed under the Zero Clause BSD License.
See History and License for more information.
The Python Software Foundation is a non-profit corporation. Please donate.
Last updated on Dec 27, 2025 (15:26 UTC). Found a bug?
Created using Sphinx 9.0.4.
This page is licensed under the Python Software Foundation License Version 2.
Examples, recipes, and other code in the documentation are additionally licensed under the Zero Clause BSD License.
See History and License for more information.
The Python Software Foundation is a non-profit corporation. Please donate.
Last updated on Dec 27, 2025 (15:26 UTC). Found a bug?
Created using Sphinx 9.0.4.