How to get help on methods in Python? [duplicate]

柔情痞子 提交于 2021-02-10 06:10:06

问题


whenever I use help() on a method I get a weird looking output. For example, help(obj.readline) gives me the following output:

Help on built-in function readline:

readline(...)

That's all i get. I don't know how to interpret it.Why there is no description about the method? Can somebody please explain to me what's going on?


回答1:


Is this weird output?

>>> 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.


来源:https://stackoverflow.com/questions/17018187/how-to-get-help-on-methods-in-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!