how to get current cpu and ram usage in python 3f

Solutions on MaxInterview for how to get current cpu and ram usage in python 3f by the best coders in the world

showing results for - "how to get current cpu and ram usage in python 3f"
Yannic
20 Oct 2020
1#!/usr/bin/env python
2import psutil
3# gives a single float value
4psutil.cpu_percent()
5# gives an object with many fields
6psutil.virtual_memory()
7# you can convert that object to a dictionary 
8dict(psutil.virtual_memory()._asdict())