国产探花免费观看_亚洲丰满少妇自慰呻吟_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 

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 抚州市| 莎车县| 县级市| 钟祥市| 安图县| 河北区| 岐山县| 洪雅县| 鄂伦春自治旗| 航空| 鄯善县| 石狮市| 凭祥市| 精河县| 济阳县| 于都县| 汕尾市| 厦门市| 任丘市| 巫溪县| 广丰县| 双江| 丰都县| 邵武市| 宣武区| 阳新县| 民乐县| 桓台县| 汝城县| 吉安县| 彭泽县| 新宁县| 扬中市| 东山县| 灵寿县| 竹北市| 英山县| 阿坝县| 绍兴市| 辉县市| 新田县|