TIL: Python's `webbrowser` module


#Python

Open a webbrowser to a specific page with Python.

webbrowser

I was thinking this would be very useful in do nothing scripts.

Example 1:

Python Console Session
>>> import webbrowser
>>> url = "https://sglmr.com"
>>> webbrowser.open(url)

Example 2:

Bash
python -m webbrowser "https://www.python.org"

Example 3:

Bash
uv run -m webbrowser "https://example.com"