Python Platform – Check python version

In this post we will be creating a script which will check which version of Python we are running, to do this we will be using the ‘platform’ library which gives access to underlying platform’s identifying data.

Knowing which version of Python you are running is important as newer versions typically contain enhanced features that will make writing code easier. For more on the latest version of Python click here.

See the snippet of code below where we make use of the ‘python_version()’ function to check the version of Python being used.

from platform import python_version

An example of what the above would return as output can be seen below.


Take a look at some of our other content around the Python programming language by clicking here.

Leave a Reply