Python pydoc模块

来源:互联网 发布:中山淘宝产品摄影 编辑:程序博客网 时间:2024/04/30 19:16

 

The pydoc module imports a Python module and uses the contents to generate help text at runtime. The output includes docstrings for any objects that have them, and all of the documentable contents of the module are described.

Plain Text Help¶

Running:

$ pydoc atexit

Produces plaintext help on the console, using your pager if one is configured.

HTML Help¶

You can also cause pydoc to generate HTML output, either writing a static file to a local directory or starting a web server to browse documentation online.

$ pydoc -w atexit

Creates atexit.html in the current directory.

$ pydoc -p 5000

Starts a web server listening at http://localhost:5000/. The server generates documentation as you browse through the available modules.

Interactive Help¶

pydoc also adds a function help() to the__builtins__ so you can access the same information from the Python interpreter prompt.

$ pythonPython 2.6.2 (r262:71600, Apr 16 2009, 09:17:39)[GCC 4.0.1 (Apple Computer, Inc. build 5250)] on darwinType "help", "copyright", "credits" or "license" for more information.>>> help('atexit')Help on module atexit:NAME    atexitFILE    /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/atexit.py...

 

 

 

 

 

 

看了以下2篇文章:

 

http://www.ibm.com/developerworks/cn/linux/sdk/python/charm-19/

 

http://blog.csdn.net/hoxide/article/details/51506

 

 

原创粉丝点击