[英]How can I make the docstring in PyCharm as helpful as the one in the Jupyter Notebook?
你的意思是“如何编写我自己代码的文档字符串......”?
因为,如果您使用Sphinx / reStructuredText语法,您可以拥有漂亮的文档。
这是一个基本的例子:
def axhline_demo(y=0, xmin=0, xmax=1, hold=None, **kwargs):
"""
Add a horizontal line across the axis.
Parameters
----------
:param y: scalar, optional, default: 0
y position in data coordinates of the horizontal line.
:param xmin: scalar, optional, default: 0
etc.
:param xmax: more documentation...
:param hold:
:param kwargs:
:return:
"""
你会得到:
使用菜单视图 => 快速文档 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.