Python platform.python_version_tuple()

Python platform.python_version_tuple()


The python_version_tuple() function is same as the python_version() function that is also used to identify the version of the Python on which the program is being executed. But the only difference is that python_version_tuple() returns tuple where as python_version() returns string.



No arguments are required.

Return Value:

It returns a tuple (major, minor, patchlevelthat specifies the python version

The value returned by the sys.version will always include the patch level, whose default value is 0.

Example: Program to display the python version tuple.

#import module
import platform
#displaying python version 
print("Python version:",platform.python_version_tuple())


NOTE:  In the above tuple, the first '3' represents major value, '7' represents minor value and the last '3' represents patch level.