diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2019-05-29 10:59:48 +0800 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2019-05-29 10:59:48 +0800 |
commit | 9d5ee03b5a0a088ce0e1426ad59137466116a895 (patch) | |
tree | 283dc9492b6b7cf30f51601075ea46b40d8b09b3 | |
parent | 41a20b4736a67a21a898787cb6299ba3eafeabcd (diff) | |
download | psutil-9d5ee03b5a0a088ce0e1426ad59137466116a895.tar.gz |
#1515: document how to get a list of valid attrs names for as_dict()
-rw-r--r-- | docs/index.rst | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/docs/index.rst b/docs/index.rst index d693b9f7..7a234872 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1169,6 +1169,10 @@ Process class >>> p = psutil.Process() >>> p.as_dict(attrs=['pid', 'name', 'username']) {'username': 'giampaolo', 'pid': 12366, 'name': 'python'} + >>> + >>> # get a list of valid attrs names + >>> list(psutil.Process().as_dict().keys()) + ['status', 'cpu_num', 'num_ctx_switches', 'pid', 'memory_full_info', 'connections', 'cmdline', 'create_time', 'ionice', 'num_fds', 'memory_maps', 'cpu_percent', 'terminal', 'ppid', 'cwd', 'nice', 'username', 'cpu_times', 'io_counters', 'memory_info', 'threads', 'open_files', 'name', 'num_threads', 'exe', 'uids', 'gids', 'cpu_affinity', 'memory_percent', 'environ'] .. versionchanged:: 3.0.0 *ad_value* is used also when incurring into |