look for python linux code example
Example 1: get python version in code
import platform
print(platform.python_version())
Example 2: check python version kali linux
$ python2 --version
import platform
print(platform.python_version())
$ python2 --version