What is platform.uname() in Python?

Overview

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

The platform.uname() method returns a named tuple consisting of the following attributes:

  1. system
  2. node
  3. release
  4. version
  5. machine
  6. processor

Method signature

Let’s view the method signature.

uname()

Parameters

This method takes no parameters.

Code

Let’s view the code for this method.

import platform
print("platform.uname() =", platform.uname())

Explanation

  • Line 1: We import the platform module.
  • Line 3: We retrieve the system’s uname using the uname() method.

Free Resources