I'm using psutil to generate some somatic data with the following script:

import psutil as ps

cpu = ps.cpu_percent()
mem = ps.virtual_memory()
disk = ps.disk_usage('/')

All works well, but except for cpu I am struggling to learn how to strip
out what I don't need.

For example, once I do the above, if I then enter "disk" I get:

disk usage(total=302264549376, used=73844322304, free=213066088448,
percent=24.4)

So if I want only the number following percent, I get that I need to
convert this to a built in type and do some split and strip, but that's
where I'm floundering. Might I get a little guidance on this please?

regards, Richard

-- 

*Mater tua criceta fuit, et pater tuo redoluit bacarum sambucus*
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to