Python platform.python_version()














































Python platform.python_version()




Description: 

The python_version() function is used to identify the version of the Python on which the program is being executed. 

Syntax:

platform.python_version()

No arguments are required.

Return Value:

It returns a string that specifies the version in the form- 'major.minor.patchlevel'

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.


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


Output:  

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






Comments