Wednesday, January 21, 2026
HomeLanguagesPython | platform.uname() Method

Python | platform.uname() Method

In this article, we will learn how to detect the operating system that is currently being used in your system using Python.

Detect OS Using the platform Module in Python

The platform.uname() method in python is used to get information about the current operating system. This method returns information like name, release, and version of the current operating system, name of the machine on the network, and hardware identifier in the form of attributes of a tuple-like object.

Syntax of platform.uname()

Syntax: platform.uname() 

Return Type: This method returns a tuple-like object which has five attributes:

  • sysname: operating system name
  • nodename: name of the machine on the network (implementation-defined)
  • release: operating system release
  • version: operating system version
  • machine: hardware identifier

Check Operating System using platform.uname() method 

In this method, we are using the uname() method to get OS Python information.

Python3




import platform
 
print(platform.uname())


Output: 

 

RELATED ARTICLES

Most Popular

Dominic
32475 POSTS0 COMMENTS
Milvus
119 POSTS0 COMMENTS
Nango Kala
6847 POSTS0 COMMENTS
Nicole Veronica
11977 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12064 POSTS0 COMMENTS
Shaida Kate Naidoo
6986 POSTS0 COMMENTS
Ted Musemwa
7220 POSTS0 COMMENTS
Thapelo Manthata
6933 POSTS0 COMMENTS
Umr Jansen
6912 POSTS0 COMMENTS