Home >>Python Programs >Python program to print the version information
In this example, we will see a Python program through which we can print the version information.
For printing the version information we use the "sys.version_info" that can be used after importing the "sys" module. It returns a tuple containing some components of the version number like : major, minor, micro,releaselevel, and serial.
Program:
# Python program to print the version information
# importing the module
import sys
# printing version info
print("Python version: ", sys.version)
print("Python version info: ", sys.version_info)
print("Python version info[0]: ", sys.version_info[0])
print("Python version info[1]: ", sys.version_info[1])
print("Python version info[2]: ", sys.version_info[2])
print("Python version info[3]: ", sys.version_info[3])
print("Python version info[4]: ", sys.version_info[4])