【问题标题】:Reading Python Documentation for 3rd party modules阅读第 3 方模块的 Python 文档
【发布时间】:2010-03-14 01:30:39
【问题描述】:

我最近下载了 IMDbpy 模块.. 当我这样做时,

import imdb
help(imdb)

我没有得到完整的文档。我必须这样做

im = imdb.IMDb()
help(im)

查看可用的方法。我不喜欢这个控制台界面。有没有更好的阅读文档的方法。我的意思是所有与 module imdb 在一页中的文档。

【问题讨论】:

    标签: python documentation pydoc imdbpy


    【解决方案1】:

    使用pydoc

    pydoc -w imdb
    

    这将在同一目录中生成 imdb.html。


    pydoc -p 9090 将在端口 9090 上启动 HTTP 服务器,您将能够在 http://localhost:9090/ 浏览所有文档

    【讨论】:

    • 我试过了.. 但是,我仍然没有在文档 html 中获得“im”的方法
    • 我仍然没有在文档中得到“im”的方法。为什么答案被赞成...?
    • pydoc -p 中看不到什么功能?我可以看到包含所有功能的公司、人员、电影等类。
    • 对不起,如果这很愚蠢..但是,我仍然没有在文档中看到方法“ia.search_movie()”..
    • @Shadyabhi:上述方法的文档可以在 'Parser(package) -> http(package)' 或 localhost:1234/imdb.parser.http.html 找到(如果您的服务器正在运行)。我不知道为什么文档在那里,但它存在:)。
    【解决方案2】:

    IPython 你可以做

    [1]: import os
    [2]: os?
    
    < get the full documentation here >
    
    # or you could do it on specific functions 
    [3]: os.uname
    <built-in function>
    
    
    
    [4]: os.uname?
    
    < get the full documentation here >
    
    
    # Incase of modules written in python, you could inspect source code by doing
    [5]: import string
    [6]: string??
    
    < hows the source code of the module >
    
    [7]: string.upper??
    
    < shows the source code of the function >
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-09-20
      • 1970-01-01
      • 2020-10-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多