Python 注释文档

2019-04-22  本文已影响0人  _沉默的疯子

函数注释文档

def test(name, age):
    """
    Rest风格 注释 
    :param name: 参数注释
    :param age: 参数注释
    :return: 返回注释
    """
    print("hello")
    return name
def test1(name, age):
    """
    Google风格 This is groups style docs.

    Parameters:
        name - this is the name param
        age - this is a age param

    Returns:
        This is a description of what is returned

    Raises:
        KeyError - raises an exception
    """
    name = "andy"
    age = 10
    return "yoyo"
help(test1)
上一篇 下一篇

猜你喜欢

热点阅读