alex_bn_lee

导航

【321】python进程监控:psutil

参考:Python进程监控-MyProcMonitor

参考:Python3.6 安装psutil 模块和功能简介

参考:psutil module (Download files)

参考:廖雪峰 - psutil


  判断指定进程是否存在

import psutil
# 获取进程id
ps = psutil.pids()
# 判断是否有putty进程,默认只有一个putty
for pi in ps:
	p = psutil.Process(pi)
	if p.name().find("putty") == 0:
            print("putty已经运行~")

 

posted on 2018-06-21 14:30  McDelfino  阅读(1724)  评论(0编辑  收藏  举报