python kill process code example
Example 1: python kill script
import sys
sys.exit()
Example 2: kill a process with pid
kill -9 PID # kill -9 94228
Example 3: python kill process windows
import os
os.system("taskkill /im make.exe")
Example 4: linux kill python
ps -elf | grep python
kill -9 <whatever_the_PID_is>
Example 5: kill and run process in windows python
import os
os.system("taskkill /im make.exe")
Example 6: kill python
pkill -9 python