Skip to content
Related Articles

Related Articles

Python – Get Hardware and System information using platform module

View Discussion
Improve Article
Save Article
Like Article
  • Last Updated : 26 Mar, 2020

In this article, we will see how we can show information about our system i.e processor name, name of system etc.

The Platform module is used to retrieve as much possible information about the platform on which the program is being currently executed. Now by platform info, it means information about the device, it’s OS, node, OS version, Python version, etc. This module plays a crucial role when you want to check whether your program is compatible with the python version installed on a particular system or whether the hardware specifications meet the requirements of your program.

In order to do this we need to import platform module.

import platform

Below is the Python implementation –

# importing module
import platform
# dictionary
info = {}
# platform details
platform_details = platform.platform()
# adding it to dictionary
info["platform details"] = platform_details
# system name
system_name = platform.system()
# adding it to dictionary
info["system name"] = system_name
# processor name
processor_name = platform.processor()
# adding it to dictionary
info["processor name"] = processor_name
# architectural detail
architecture_details = platform.architecture()
# adding it to dictionary
info["architectural detail"] = architecture_details
# printing the details
for i, j in info.items():
    print(i, " - ", j)

Output :

platform details  -  Windows-10-10.0.17134-SP0
system name  -  Windows
processor name  -  Intel64 Family 6 Model 158 Stepping 10, GenuineIntel
architectural detail  -  ('64bit', 'WindowsPE')

Note : Output may vary based on you system architecture.

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!