platform.python_version()

platform.python_version()[source]

Returns the Python version as string ‘major.minor.patchlevel’

Note that unlike the Python sys.version, the returned value will always include the patchlevel (it defaults to 0).