Python 获取进程PID

Python 通过subprocess模块获取进程pid
9 年前

Python 获取进程PID

Python 获取进程PID   python subprocess pid   python commands pid   Shell/Python  

一、使用subprocess模块通过查找关键字获取进程PID #!/usr/bin/python import subprocess import sys import logging import os gameproc = ["loginserver","gameserver","dbserver","logserver"] def getPid(process): cmd = "ps…