python中有内置的语法库吗?

2024-04-19 19:43:04 发布

您现在位置:Python中文网/ 问答频道 /正文

我是python新手,我想知道是否有任何方法可以列出函数/符号及其描述的列表?我试过help(),但它只显示符号列表,并且只显示它们的描述,如果你知道你要找的是哪一个。我正试图找到一种方法,在没有浏览器帮助的情况下,找出用哪个函数/符号来解决问题。你知道吗


Tags: 方法函数列表符号help情况浏览器解决问题
2条回答

Python标准库是海量的。如果没有Python docs site,你的日子会很不好过。请注意,有一个download link,这样您就可以在本地使用它;如果您使用纯文本版本,它可以满足您的“无浏览器”问题。你知道吗

您可以将此页用作参考:

https://docs.python.org/3/library/functions.html

或者尝试pydochelp()dir()。你知道吗

例如,在控制台中,在help命令之后搜索任何内容,如下所示:

>>> help(max)

Help on built-in function max in module __builtin__:

max(...)
    max(iterable[, key=func]) -> value
    max(a, b, c, ...[, key=func]) -> value

    With a single iterable argument, return its largest item.
    With two or more arguments, return the largest argument.
(END)

或类似于以下可用模块:

pydoc -k <keyword>
    Search for a keyword in the synopsis lines of all available modules.

例如:

pydoc -k doc

DocXMLRPCServer - Self documenting XML-RPC Server.
doctest - Module doctest   a framework for running examples in docstrings.
email.mime.application - Class representing application/* type MIME documents.
email.mime.audio - Class representing audio/* type MIME documents.
email.mime.image - Class representing image/* type MIME documents.
email.mime.message - Class representing message/* MIME documents.
email.mime.text - Class representing text/* type MIME documents.
markupbase - Shared support for scanning document type declarations in HTML and XHTML.
pydoc - Generate Python documentation in HTML or text for interactive use.
pydoc_data 
pydoc_data.topics 
xml.dom - W3C Document Object Model implementation for Python.
setuptools.command.upload_docs - upload_docs

玩得开心。你知道吗

相关问题 更多 >