Skip to content

Instantly share code, notes, and snippets.

@codesynapse
Last active August 29, 2015 13:56
Show Gist options
  • Save codesynapse/8808177 to your computer and use it in GitHub Desktop.
Save codesynapse/8808177 to your computer and use it in GitHub Desktop.
How to Open a Web Browser from Python
# For documentation of the webbrowser module,
# see http://docs.python.org/library/webbrowser.html
import webbrowser
new = 2 # open in a new tab, if possible
# open a public URL, in this case, the webbrowser docs
url = "http://docs.python.org/library/webbrowser.html"
webbrowser.open(url,new=new)
# open an HTML file on my own (Windows) computer
url = "file://X:/MiscDev/language_links.html"
webbrowser.open(url,new=new)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment