【问题标题】:How to get help on methods in Python? [duplicate]如何获得 Python 中方法的帮助? [复制]
【发布时间】:2013-06-05 18:32:42
【问题描述】:

每当我在一个方法上使用help() 时,我都会得到一个看起来很奇怪的输出。 例如,help(obj.readline) 给我以下输出:

Help on built-in function readline:

readline(...)

这就是我所得到的。我不知道怎么解释。为什么没有关于方法的描述?有人可以向我解释发生了什么吗?

【问题讨论】:

    标签: python python-2.7 python-3.x


    【解决方案1】:

    这是奇怪的输出吗?

    >>> f = open('data.txt')
    >>> help(f.readline)
    Help on built-in function readline:
    
    readline(...)
        readline([size]) -> next line from the file, as a string.
    
        Retain newline.  A non-negative size argument limits the maximum
        number of bytes to return (an incomplete line may be returned then).
        Return an empty string at EOF.
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-01-18
      • 2021-11-10
      • 1970-01-01
      • 2016-06-22
      • 1970-01-01
      相关资源
      最近更新 更多