[Tutor] Is there a way I can print the output of help(module)?

Steven D'Aprano steve at pearwood.info
Fri Apr 27 21:03:07 CEST 2012

Joel Goldstick wrote:
> Its really nice how python displays help from the docstrings of
> modules.  I'd like to save this info to a file, and I realize I've
> never come across how to do that.

At the command prompt (not the Python interactive interpreter!), run the pydoc 

pydoc math

will display the documentation for help.

pydoc -w math

will write it to a file math.html.

To do the same thing from the interactive interpreter, start with:

import pydoc

and go from there.


More information about the Tutor mailing list