【问题标题】:Does python have any offline documentation included like manpages in C? [duplicate]python 是否包含任何脱机文档,例如 C 中的联机帮助页? [复制]
【发布时间】:2019-12-09 01:48:12
【问题描述】:

我来自 C 背景,每当我想查看我刚刚做的事情的文档时都使用 C man 3 thing 例如:

$ man 3 open
NAME
       open, openat — open file relative to directory file descriptor

SYNOPSIS
       #include <sys/stat.h>
       #include <fcntl.h>

       int open(const char *path, int oflag, ...);
       int openat(int fd, const char *path, int oflag, ...);

我想知道 Python 是否也有类似的东西。

【问题讨论】:

  • &gt;&gt;&gt; help(open)
  • offline documentation 2019 年?

标签: python documentation


【解决方案1】:

好问题!

是的,python 也有,它甚至是交互式的,只需通过运行 python 在终端中打开一个 python shell。

然后输入:

help(open)

你会得到这个:

open(file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None)
    Open file and return a stream.  Raise OSError upon failure.

    file is either a text or byte string giving the name (and the path
    if the file isn't in the current working directory) of the file to
    be opened or an integer file descriptor of the file to be
    wrapped. (If a file descriptor is given, it is closed when the
    returned I/O object is closed, unless closefd is set to False.)
.
.
.

这与 C 中的手册页完全相同。

也不要忘记help(help) 了解更多信息;)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-05-07
    • 1970-01-01
    • 2016-11-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多