Python取得系统进程列表

Posted 宋兴柱-Sindrol

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Python取得系统进程列表相关的知识,希望对你有一定的参考价值。

一、上代码

import psutil

for proc in psutil.process_iter():
    try:
        pinfo = proc.as_dict(attrs=[\'pid\', \'name\'])
    except psutil.NoSuchProcess:
        pass
    else:
        print(pinfo)

 

二、效果:

 

以上是关于Python取得系统进程列表的主要内容,如果未能解决你的问题,请参考以下文章