Python – Get Hardware and System information using platform module

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 –

filter_none

edit
close

play_arrow

link
brightness_4
code

# 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)

chevron_right


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.

Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :

1


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.