Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

How to get current CPU and RAM usage in Python?

#!/usr/bin/env python
import psutil
# gives a single float value
psutil.cpu_percent()
# gives an object with many fields
psutil.virtual_memory()
# you can convert that object to a dictionary 
dict(psutil.virtual_memory()._asdict())
Comment

PREVIOUS NEXT
Code Example
Python :: python 1 to 01 
Python :: Iterate through python string starting at index 
Python :: kneighbours regressor sklearn 
Python :: remove character python 
Python :: docs.python.org 
Python :: psyche asteroid 
Python :: python get system information 
Python :: pytohn epsilon 
Python :: random hex color python 
Python :: remove emoji from dataframe 
Python :: and condition with or in django 
Python :: python dont exit script after print 
Python :: raise python 
Python :: pretty json python 
Python :: auto python to exe 
Python :: how to separate a string or int with comma in python 
Python :: add text to the middle of the window tkinter 
Python :: count values pandas 
Python :: find the area of a circle in python 
Python :: python oprators 
Python :: printing python dictionary values 
Python :: python make a list of odd numbers 
Python :: format string to 2 decimal places python 
Python :: check if word contains a word in a list python 
Python :: join two dictionaries python 
Python :: pip clear download cache 
Python :: python bash command 
Python :: replace number with string python 
Python :: Python DateTime add days to DateTime object 
Python :: select only some rows pandas 
ADD CONTENT
Topic
Content
Source link
Name
7+3 =