![如何使用 Python 脚本来 grep iTunes 进程](https://linux22.com/image/1607478/%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8%20Python%20%E8%84%9A%E6%9C%AC%E6%9D%A5%20grep%20iTunes%20%E8%BF%9B%E7%A8%8B.png)
import os, signal
def check_kill_process(iTunes):
for line in os.popen("ps ax | grep " + iTunes + " | grep -v grep"):
fields = line.split()
pid = fields[0]
os.kill(int(pid), signal.SIGKILL)
import os, signal
def check_kill_process(iTunes):
for line in os.popen("ps ax | grep " + iTunes + " | grep -v grep"):
fields = line.split()
pid = fields[0]
os.kill(int(pid), signal.SIGKILL)