What is platform.version() in Python?

Overview

The platform module in Python provides functions that access the underlying platform’s (operating system) information.

The platform.version() method returns the underlying operating system’s release version. This method returns an empty string if it cannot determine the operating system’s version.

Method syntax

platform.version()

Parameters

This method has no parameters.

Return value

This method returns the underlying system’s version.

Example

import platform
print("platform.version() = %s" % (platform.version()))

Explanation

  • Line 1: We import the platform module.
  • Line 3: This is the operating system’s version on which the code is run. We use the version() method to retrieve this version.

New on Educative
Learn to Code
Learn any Language as a beginner
Develop a human edge in an AI powered world and learn to code with AI from our beginner friendly catalog
🏆 Leaderboard
Daily Coding Challenge
Solve a new coding challenge every day and climb the leaderboard

Free Resources