Wednesday, 22 November 2017

Python: Script to open a URL

Python: Script to open a WEB-URL in a Browser:
=====================================

# Tutorial: 'https://bidsarmanish.blogspot.in/2017/11/python-script-to-open-url.html'
# Tested on Python 3.6.2

import webbrowser
url = 'https://bidsarmanish.blogspot.in/'

# Open URL in new browser window
webbrowser.open_new(url) # opens in default browser

# Opens in safari browser
webbrowser.get('safari').open_new(url)

# Open URL in a new tab
webbrowser.open_new_tab(url) # opens in default browser

# Opens in safari browser
webbrowser.get('safari').open_new_tab(url)

No comments:

Post a Comment

Note: only a member of this blog may post a comment.