温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

python的docstrings文档字符串怎么用

发布时间:2022-01-13 14:50:38 来源:亿速云 阅读:153 作者:iii 栏目:大数据

本文小编为大家详细介绍“python的docstrings文档字符串怎么用”,内容详细,步骤清晰,细节处理妥当,希望这篇“python的docstrings文档字符串怎么用”文章能帮助大家解决疑惑,下面跟着小编的思路慢慢深入,一起来学习新知识吧。

文档字符串的使用

输入:


#!/usr/bin/python 

# Filename: func_doc.py

def printMax(x, y):    

    '''Prints the maximum of two numbers. The two values must be integers.'''    

    x = int(x) 

    # convert to integers, if possible    

    y = int(y)

    if x > y:        

        print(x, 'is maximum')    

    else:        

        print(y, 'is maximum')


printMax(3, 5) 

print(printMax.__doc__) 


输出:

5 is maximum    

Prints the maximum of two numbers. The two values must be integers.

解释:

函数功能的功能仍然时经过

读到这里,这篇“python的docstrings文档字符串怎么用”文章已经介绍完毕,想要掌握这篇文章的知识点还需要大家自己动手实践使用过才能领会,如果想了解更多相关内容的文章,欢迎关注亿速云行业资讯频道。

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI