gpt4 book ai didi

python - RestructuredText 中的文字 "*"

转载 作者:太空狗 更新时间:2023-10-29 20:18:31 26 4
gpt4 key购买 nike

我正在查看这段代码:

def ook(*args):
"""Some silly function.

:param *args: Optional arguments.
"""
...

一旦我运行 Sphinx,我就会得到非常有用的错误:

WARNING: Inline literal start-string without end-string.

因此,我尝试了 param ``*``argsparam :literal:'*' args,但仍然收到警告。

如何在 restructuredText 中使用文字“*”?

最佳答案

您可以使用(有点难看的)反斜杠引号:\*

编辑:作为(有点丑陋的)附录,如果您担心有关反斜杠的 pylint 警告,您可以将 r 添加到字符串文字:r""".. . 文档字符串 ... """。这在 this pylint issue 中进行了描述.

让不同的文本处理系统很好地协同工作有时会破坏美感。

关于python - RestructuredText 中的文字 "*",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30454549/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com