Python's Built-in Help Function
Python has a built-in help function help()
that provides an interactive guide to the official Python documentation. Even though I’ve been programming in Python for years, I only just started using this and it’s a real time-saver!
Interactive Mode
To enter interactive mode type help()
from the Python shell:
Then you can enter either a keyword or object to search for. Want to learn about nonlocal? Just type nonlocal
:
You can also look up information on objects, such as the str
object, again by just typing str
.
To exit the interactive mode type q
.
Noninteractive Mode
You can also access help()
directly from the Python shell.
To search for an object like str
pass it in directly as help(str)
. To search for a keyword, like nonlocal
, pass it in as a string so help('nonlocal')
.
Enjoy!
Want to improve your Python? I have a list of recommended Python books.