Getting Help

When working with Python, you have several sources of quickly available information. First, when Python is running in interactive mode, you can use the help() command to get information about built-in modules and other aspects of Python. Simply type help() by itself for general information or help(‘modulename’) for information about a specific module. The help() command can also be used to return information about specific functions if you supply a function name.

Most Python functions have documentation strings that describe their usage. To print the doc string, simply print the __doc__ attribute. Here’s an example:

						>>> print issubclass.__doc__ issubclass(C, B) -> bool Return whether class C is a subclass (i.e., a derived class) ...

Get Python: Essential Reference, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.