8.7. Python’s Antigravity Feature

To enable Python’s antigravity feature, enter the following into the interac- tive shell:

>>> import antigravity

This line is a fun Easter egg that opens the web browser to a classic XKCD comic strip about Python at https://xkcd.com/353/. It might surprise you that Python can open your web browser, but this is a built-in feature the w ­ ebbrowser module provides. Python’s webbrowser module has an open() function that finds your operating system’s default web browser and opens a browser window to a specific URL. Enter the following into the interactive shell:

>>> import webbrowser
>>> webbrowser.open('https://xkcd.com/353/')
False

The webbrowser module is limited, but it can be useful for directing the user to further information on the internet.