本文小编为大家详细介绍“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文档字符串怎么用”文章已经介绍完毕,想要掌握这篇文章的知识点还需要大家自己动手实践使用过才能领会,如果想了解更多相关内容的文章,欢迎关注天达云行业资讯频道。