Open a URL in the browser.

url = "http://example.com"

webbrowser

  • webbrowser standard library in the docs.

    The webbrowser module provides a high-level interface to allow displaying web-based documents to users. Under most circumstances, simply calling the open() function from this module will do the right thing.

import webbrowser

webbrowser.open(url)

urllib

import urllib.request

resp = urllib.request.urlopen(url)