python cmd下关闭exe程序(关闭浏览器驱动)

import os
def close_process( process_name):
    """Close a process by process name."""
    if process_name[-4:].lower() != ".exe":
        process_name += ".exe"
    os.system("taskkill /f /im " + process_name)
#close_process("geckodriver.exe")

 

posted @ 2019-08-19 17:29  科学小怪癖  阅读(1519)  评论(0编辑  收藏  举报