An easy tip to quickly access the Python reference
If you are like me, you visit the Python Standard Library Reference all the time. You already know there’s a “datetime” module, a “random” module, an “os.path” module, and so on, so how do you quickly go there to read the reference? Here’s what I do.
I switch to my browser with Alt+Tab, I key in Ctrl+L or Ctrl+T, in the URL tab I type “p3 datetime”, and I press Enter. The whole procedure takes less than 3 seconds, and it immediately takes me to the Python 3 reference for datetime.
How to do it
Firefox: Visit https://docs.python.org/3/library/datetime.html and bookmark it. Go to the properties of the new bookmark, change the name to “Python 3 Library Reference”, specify “p3” in the keyword field, and in the URL change the “datetime” part to “%s”, so that the whole URL is https://docs.python.org/3/library/%s.html.
Other browsers: I don’t know, but the information is around (e.g. Chrome)
Actually I have a copy of the documentation on my local machine, so the URL I’m actually using is file:///usr/share/doc/python3-doc/html/library/%s.html.
I have such shortcuts for the Python 3 library, the Python 2 library, the Django settings (but the setting must be typed in lower case and with hyphens instead of underscores, such as “secret-key”), the Ansible library, and more.
Update
For the JavaScript/CSS/HTML reference, I use this search string on DuckDuckGo: \%s site:developer.mozilla.org
. The backslash means “redirect me to the first search result”, similar to Google’s “I’m feeling lucky”. You first need to make a search without the backslash, so that you can see the resulting URL and bookmark it, and then go add the backslash to it and specify the keyword mdn
. Then type Ctrl+L and mdn array
and there you are, straight at the reference of Array
.
This is a republication of an old article first published in my Django Deployment site.