What is platform.release() in Python?

Overview

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

The platform.release() method is used to return the underlying operating system release. Compared to the platform.version() method, this method returns a simpler string indicating only the release of the operating system. This method returns an empty string if it’s not able to determine the operating system release.

Method signature

platform.release()

Parameters

This method takes no parameters.

Return value

This method returns the underlying system’s release.

Example

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

Explanation

  • Line 1: We import the platform module.
  • Line 3: We retrieve the operating system’s release on which the code is run using the release() method.

Free Resources