Open a new file in IDLE.

Then type the following program.

 

import webbrowser

newTab = 2 # open in a new tab, if your browser is already opened

# open a URL in your default browser
url = “http://www.linoroid.com”
webbrowser.open(url,new=newTab)

 

Now, save the file with .py extension

Run the program from Run-> Run Module   or   hit   F5








Open an URL from a python program

Leave a Reply

Your email address will not be published. Required fields are marked *