python --kill掉django脚本
import os
pid = []
sub = os.popen('ps -ef | grep python').readlines()
for i in sub:
if 'manage.py runserver' in i:
pid.append(i.split()[1])
if len(pid) > 0:
print(f'django进程总个数为:{len(pid)},是否杀掉所有进程,y 或 n')
yes = input('请输入:')
if yes == 'n':
...
else:
for i in pid:
print(f'杀掉pid为{i}的进程成功')
os.system(f'kill -9 {i}')
else:
print('暂未找到django进程')