python - 如何使用Python 3中的帮助函数查看文件处理函数文档?

标签 python python-3.x file-io

我正在尝试使用 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/

相关文章:

Python 有 dir(obj) 和 help(obj),在 Lua 中有对应的吗?

python - 属性错误 : object has no attribute 'execute'

python - 如果选择了另外两个 QCheckbox,则能够禁用 QCheckbox

java - 如何删除写入文件的对象?

java - java中的输入流

python - py2exe 无法加载指定模块

python - 仅使用 python 封装 c 库

python - 比较/映射不同数据帧中的不同系列

python - 使用 Python 替换 JSON 文件中的字符。由于文件过大(超过 1 GB)导致编辑出现问题

python - 从文件中获取字数,忽略 python 中的注释行