Header Ads Widget

Responsive Advertisement

write a python program to get the python version you are using

write a python program to get the python version you are using

>>>
>>> import os
>>> os.system("python --version")
Python 3.8.5
0
>>>

 

Another Method

>>> import sys
>>> sys.version_info
sys.version_info(major=3, minor=8, micro=5, releaselevel='final', serial=0)
>>>

 

Print only version

import sys

print(sys.version_info[0], sys.version_info[1]) 


Get Version Using Platform Library

>>>
>>> import platform
>>> print(platform.python_version())
3.8.5
>>>


 

















Post a Comment

0 Comments