help() function
Bengt Richter
bokr at oz.net
Mon Nov 4 20:03:58 EST 2002
On 4 Nov 2002 18:05:19 -0600, Chris Spencer <clspence at one.net> wrote:
> The documentation makes it clear that the help() function is only used
>in interactive mode. However, I see it as a really neato-way of generating
>standalone .txt files from docstrings in modules. However, as it currently
>stands, it looks like help() can ONLY be used in interactive mode, which means I
>can't capture the output to a file.
> Is there any way to get the same docstring formatting that help() uses,
>but be able to capture it to a variable or a file handle?
> Inquiring minds want to know.
>
YPMV (Your Path May Vary) but just type
[17:01] C:\pywk>D:\Python22\Lib\pydoc.py
pydoc - the Python documentation tool
D:\Python22\Lib\pydoc.py <name> ...
Show text documentation on something. <name> may be the name of a
function, module, or package, or a dotted reference to a class or
function within a module or module in a package. If <name> contains
a '\', it is used as the path to a Python source file to document.
D:\Python22\Lib\pydoc.py -k <keyword>
Search for a keyword in the synopsis lines of all available modules.
D:\Python22\Lib\pydoc.py -p <port>
Start an HTTP server on the given port on the local machine.
D:\Python22\Lib\pydoc.py -g
Pop up a graphical interface for finding and serving documentation.
D:\Python22\Lib\pydoc.py -w <name> ...
Write out the HTML documentation for a module to a file in the current
directory. If <name> contains a '\', it is treated as a filename; if
it names a directory, documentation is written for all the contents.
If you are on windows and want to capture output, don't forget to run it
explicitly with
python D:\Python22\Lib\pydoc.py > a_file.txt
as extension-triggered program output is not always redirectable.
Regards,
Bengt Richter
More information about the Python-list
mailing list