您的位置:首页 > 编程语言 > Python开发

Python DocString特性

2011-11-27 20:08 375 查看
#!/usr/bin/python
#Filename:func_doc.py

def printMax(x,y):
'''Prints the maximum of two numbers

the two valuse must be integers'''
x = int(x)
y = int(y)

if(x > y):
print x,'is maximum'
else:
print y,'is maximum'

printMax(3,5)
print printMax.__doc__


在函数的第一个逻辑行的字符串是这个函数的 文档字符串 。注意,DocStrings也适用于模块和

类,我们会在后面相应的章节学习它们。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: