How to Close a program using python?

# I have used subprocess comands for a while
# this program will try to close a firefox window every ten secounds

import subprocess
import time

# creating a forever loop
while 1 :
    subprocess.call("TASKKILL /F /IM firefox.exe", shell=True)
    time.sleep(10)

Leave a Comment