How to open a Website using Python

Using Python, we can open a website which loads a browser window with the specified URL.
The webbrowser module provides a high-level interface to allow displaying websites to users.
By simply calling the open() function from this module will open URL using the default browser. You have to import the module and use the open() function.
import webbrowser webbrowser.open('http://www.google.com', new = 0)
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.
import webbrowser webbrowser.open('http://www.google.com', new = 1)
Subscribe
Login
Please login to comment
0 Discussion