提供 Python 文档的好网站,例如 ruby​​-doc.org

发布于 2024-12-13 07:28:27 字数 1539 浏览 2 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

过气美图社 2024-12-20 07:28:27

这不是另一个网站,而是访问文档的不同方式(如果您很慷慨,甚至可能有资格作为文档的 api)。您所需要的只是一个 Python 解释器:

import csv
print csv.__doc__
dir(csv)
print csv.reader.__doc__

我发现这是一种快速检查方法拼写方式或参数顺序的好方法,而无需打开 Web 浏览器。

或者,正如 Steven Rumbalski 所指出的,还有 内置函数 help。这可以交互地使用来显示有关给定模块的更多信息。此外,正如 rplnt 所指出的,许多 shell 都有一些语法糖来访问 python 的帮助/自我文档功能。

然而,如果您确实认真地想以编程方式创建自己的文档网站/系统,那么一个不错的开始可能是使用内置的 dir 爬取给定模块的对象层次结构,并编译 所有不同方法/函数的文档字符串(这是什么__doc__ 正在访问)。

不过,我个人认为,在大多数情况下,交互式帮助和在 google 中使用 site:docs.python.org 的结合就足够了。

This is not another website, but is a different way to access the docs (and may even qualify as an api to the docs if you're being generous). All you need is a python interpreter:

import csv
print csv.__doc__
dir(csv)
print csv.reader.__doc__

I've found that this is a great way to do a quick check on exactly how to spell a method, or what the order of arguments is, without having to bring up a web-browser.

Or, as pointed out by Steven Rumbalski, there is also the builtin function help. This can be used interactively to show more information about a given module. Also, as pointed out by rplnt, many shells have some syntactic sugar to accessing the help/self documentation features of python.

If however, you were actually serious about programmatically creating your own documentation website/system, a decent start could be to crawl through the object hierarchy of a given module, using the dir builtin, and compiling the docstrings of all the different methods/functions (this is what __doc__ is accessing).

I'm personally of the opinion, however, that a combination of the interactive help and using site:docs.python.org in google is more than sufficient in most cases.

白鸥掠海 2024-12-20 07:28:27

我多年来一直使用 Thomas Heller 的在线帮助系统作为一种快速方法访问 Python 库参考、语言参考和 Python/C API 手册中的材料。

由于它是基于 CGI 的,因此在 Windows 上可以使用 AutoHotKey 之类的东西来创建一个键盘宏,以便在选择一些文本后访问它从您最喜欢的 Python IDE 或纯文本编辑器中。

I've used Thomas Heller's online help system for many years as a quick way to access material in the Python Library Reference, Language Reference, and Python/C API manuals.

Since it's CGI based, on Windows one could use something like AutoHotKey to make a keyboard macro to access it after selecting some text from within your favorite Python IDE or plain-text editor.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文