Write a python program to get python version

In this source code example, we will write a python program to get the python version and version information.

Write a python program to get the python version

import sys
print("Python version is:")
print(sys.version)
print("Python version information is:")
print(sys.version_info)

Output:

Python version is:
3.8.10 (default, Mar 15 2022, 12:22:08) 
[GCC 9.4.0]
Python version information is:
sys.version_info(major=3, minor=8, micro=10, releaselevel='final', serial=0)

Comments