国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > Python > 正文

Python文檔生成工具pydoc使用介紹

2020-02-23 01:28:47
字體:
來源:轉載
供稿:網友

在Python中有很多很好的工具來生成字符串文檔(docstring),比如說: epydoc、doxygen、sphinx,但始終覺得pydoc還是不錯的工具,用法非常簡單,功能也算不錯,本文主要介紹pydoc.
pydoc是Python自帶的模塊,主要用于從python模塊中自動生成文檔,這些文檔可以基于文本呈現的、也可以生成WEB 頁面的,還可以在服務器上以瀏覽器的方式呈現!
【用法】

Windows下:
代碼如下:
D:/>python -m pydoc <modulename>   # 比如說: python -m pydoc math   
-m參數:Python以腳本的方法運行模塊

Linux/Unix下:
代碼如下:
$ pydoc <modulename>               # 比如說: pydoc  

【幫助】
代碼如下:
$ pydoc -h 
pydoc - the Python documentation tool 
 
 
pydoc <name> ... 
    Show text documentation on something.  <name> may be the name of a 
    Python keyword, topic, 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. If name is 'keywords', 'topics', 
    or 'modules', a listing of these things is displayed. 
 
 
pydoc -k <keyword> 
    Search for a keyword in the synopsis lines of all available modules. 
 
 
pydoc -p <port> 
    Start an HTTP server on the given port on the local machine. 
 
 
pydoc -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. 

【參數 -p】在本地機器上,按照給定的端口啟動HTTP,
代碼如下:
D:/>python -m pydoc -p 1234 #比如說: 端口為1234
pydoc server ready at http://localhost:1234/
pydoc server stopped

在IE中輸入:http://localhost:1234/,效果如圖:

【參數 -k】在所有可用的模塊中按關鍵字搜索
代碼如下:
$ pydoc -k xml.sax 
xml.sax (package) - Simple API for XML (SAX) implementation for Python. 
xml.sax._exceptions - Different kinds of SAX Exceptions 
xml.sax.expatreader - SAX driver for the pyexpat C module.  This driver works with 

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 防城港市| 景东| 浑源县| 卢氏县| 怀集县| 即墨市| 邵武市| 石河子市| 内乡县| 依兰县| 临沭县| 清镇市| 富川| 宁武县| 南川市| 湖北省| 永定县| 溧水县| 辛集市| 秦皇岛市| 栖霞市| 绿春县| 滁州市| 隆林| 枣强县| 武义县| 元江| 怀安县| 榆社县| 寻乌县| 龙海市| 五常市| 武清区| 乌鲁木齐县| 双江| 嘉定区| 霍林郭勒市| 平塘县| 涿鹿县| 台东市| 罗平县|