How to close the existing browser tab using the Python webbrowser package

karthik.zorfy picture karthik.zorfy · May 19, 2015 · Viewed 11.6k times · Source

Using Python webbrowser package I can open a new tab with a specified URL. Is there a way to close this tab? I referred the below official docs and nothing related to close action is mentioned.

Python webbrowser package doc: https://docs.python.org/3/library/webbrowser.html

Answer

XiR_ picture XiR_ · Jun 9, 2015

No, webbrowser doesn't have methods to close tabs nor browser itself as you may see in its documentation page: https://docs.python.org/2/library/webbrowser.html