Is the content available in the html doc available in help()?

Steve D'Aprano steve+python at pearwood.info
Sat Sep 17 23:26:30 EDT 2016


On Sun, 18 Sep 2016 10:50 am, Peng Yu wrote:

> Hi, I want to get the same content as the html doc from help(). I am
> not sure if this is possible (as I tried help(inspect) which does not
> give the same content). Could anybody confirm if there is a way to get
> the same content from help()? Thanks.
> 
> https://docs.python.org/2/library/inspect.html


help() does *not* return the same documentation as on the website. The
website usually includes a lot more detail.

The help() function introspects the python source code and formats the
docstrings found, so it will often be very much smaller.

If you want a copy of the actual Python docs from the website, use a
third-party downloader to mirror the docs.python.org site. (On Linux, you
can use wget.) But before you do that, which is considered a bit rude, have
you checked *both* the Download and Documentation pages on the website to
see if there is a link to download the documentation?

Or you can get the .rst files from Python's source repository, then use
Sphinx to compile the .rst files to HTML.

If you are using Linux, your package manager (such as yum, apt-get or
similar) may have a package for the Python docs. Try `yum install
python-docs` or similar.


On the other hand, if you want help() to generate the documentation as a
HTML page, I don't think the help() function itself will do it, but the
pydoc module does. You can call pydoc from the shell prompt (NOT the Python
prompt, the shell):

pydoc --help


for details.




-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.




More information about the Python-list mailing list