sys.hexversion
hexversion
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 final, use:
if sys.hexversion >= 0x010502F0: # use some advanced feature ... else: # use an alternative implementation or warn the user ...
This is called “hexversion” since it only really looks meaningful when viewed as a hexadecimal number, such as the result of passing it to the built-in hex function. The sys.version_info value may be used for a more human-friendly encoding of the same information. New in version 1.5.2.
