I have opened a webbrowser window using webbrowser.open(url)
in python now I want to close the webbrowser opened using python. Is it possible to do so?
37866 次
2 回答
9
There is no webbrowser.close, you can use these codes to close the task(in Windows OS):
First Import os package with
import os
then use system function to kill the task
os.system("taskkill /im firefox.exe /f")
os.system("taskkill /im chrome.exe /f")
于 2017-05-30T08:48:18.947 回答
5
For MacOS, you can use below command:
os.system("killall -9 'Google Chrome'")
于 2018-06-28T04:14:23.973 回答