Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Opening and Closing a webpage in browser from Python

Tags:

python

html

Is there any way to open a browser window with a specified URL, then close the browser at a later point?

like image 334
W00t Avatar asked Sep 06 '25 03:09

W00t


1 Answers

Yes, use python's builtin webbrowser module for this.

>>> import webbrowser
>>> url = 'http://www.python.org/'
>>> webbrowser.open_new(url)
like image 192
RanRag Avatar answered Sep 07 '25 21:09

RanRag