Call to operating system to open url?

Here is how to open the user’s default browser with a given url:

import webbrowser

url = "https://www.google.com/"

webbrowser.open(url, new=0, autoraise=True)

Here is the documentation about this functionality. It’s part of Python’s stdlibs:

http://docs.python.org/library/webbrowser.html

I have tested this successfully on Linux, Ubuntu 10.10.

Leave a Comment