How to use os module (only for Unix) In Python

Example:

Python3




import os
 
print(os.uname())


Output: 
 

(‘Linux’, ‘mycomputer.domain.user’, ‘2.6.18-92.1.22.el5PAE’, ‘#1 SMP Tue APR 16 12:36:25 EST 2020’, ‘i686’)

 

Get Your System Information – Using Python Script

Getting system information for your system can easily be done by the operating system in use, Ubuntu let’s say. But won’t it be fun to get this System information using Python script? In this article, we will look into various ways to derive your system information using Python.

There are two ways to get information:

  1. Using Platform module
  2. subprocess 
     

Similar Reads

1. Using Platform module:

Installation of the platform module can be done using the below command:...

Using WMI module (only for Windows):

...

Using os module (only for Unix):

The WMI module can be used to gain system information of a windows machine and can be installed using the below command:...

Using psutil module:

...

2. Using the subprocess  module:

Example:...