How to open web browser in Python
In this article, we will see how to open web browser in Python.
The webbrowser module provides an interface for displaying Web-based documents to users. By simply calling the open() function from this module will open the URL using the default browser. You have to import the module and use open()
function.
import webbrowser webbrowser.open('http://google.com', new = 1)
- If new is 0, the URL is opened in the same browser window if possible.
- If new is 1, a new browser window is opened if possible.
- If new is 2, a new browser page (“tab”) is opened if possible.
Subscribe
Login
Please login to comment
0 Discussion