ID EN
Sys

hexversion

Python 3.11

The version number encoded as a single integer. This is guaranteed to increase with each version, including proper support for non-production releases. For example, to test that the Python interpreter is at least version 1.5.2, use:

Syntax

PYTHON
sys.hexversion

Examples

Example 1
PYTHON
if sys.hexversion >= 0x010502F0:
     use some advanced feature
    ...
else:
     use an alternative implementation or warn the user
    ...

See Also

hex() named tuple sys.version_info API and ABI Versioning