How to get hardware information using Python

I am trying to get hardware information using Python. In fact, I want to get the total RAM of the computer. I already tried to use the modules "platform" and "sys", but this was unsuccessful.

+4
source share
1 answer

Using psutil :

>>> import psutil
>>> psutil.virtual_memory()
vmem(total=8374149120L, available=2081050624L, percent=75.1, used=8074080256L, free=300068864L, active=3294920704, inactive=1361616896, buffers=529895424L, cached=1251086336)
>>> psutil.swap_memory()
swap(total=2097147904L, used=296128512L, free=1801019392L, percent=14.1, sin=304193536, sout=677842944)
>>>
+5
source

Source: https://habr.com/ru/post/1536260/


All Articles