platform.python_version_tuple()

platform.python_version_tuple()[source]

Returns the Python version as tuple (major, minor, patchlevel) of strings.

Note that unlike the Python sys.version, the returned value will always include the patchlevel (it defaults to 0).