我正在尝试使用help()函数在Python Idle中查看文件处理函数文档。

到目前为止,我已经完成了以下工作:

>>> fh = open('file.txt', 'w')
>>> help(fh.seek)
Help on built-in function seek:

seek(...)


我如何获得文档?

最佳答案

>>> import io
>>> help(io.FileIO.seek)


返回值:

Help on method_descriptor:

seek(...)
    seek(offset: int[, whence: int]) -> None.  Move to new file position.

    Argument offset is a byte count.  Optional argument whence defaults to
    0 (offset from start of file, offset should be >= 0); other values are 1
    (move relative to current position, positive or negative), and 2 (move
    relative to end of file, usually negative, although many platforms allow
    seeking beyond the end of a file).
    Note that not all file objects are seekable.
(END)


(Python 3.4.0)

关于python - 如何在Python 3中使用帮助功能查看文件处理功能文档?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/22839500/

10-11 08:34