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.
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):
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.