How to Close a program using python?

前端 未结 6 1546
小鲜肉
小鲜肉 2020-12-05 05:27

Is there a way that python can close a windows application (example: Firefox) ?

I know how to start an app, but now I need to know how to close one.

6条回答
  •  一生所求
    2020-12-05 05:38

    # I have used os comands for a while
    # this program will try to close a firefox window every ten secounds
    
    import os
    import time
    
    # creating a forever loop
    while 1 :
        os.system("TASKKILL /F /IM firefox.exe")
        time.sleep(10)
    

提交回复
热议问题