首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > perl python >

一段小代码,求解释下。该怎么解决

2012-04-27 
一段小代码,求解释下。Python codedef break_words(stuff):this fuction will break up words forus.

一段小代码,求解释下。

Python code
def break_words(stuff):    """this fuction will break up words for  us."""    words=stuff.split(' ')    return words



"""this fuction will break up words for us."""

这段是怎么回事呢。


[解决办法]
docstring
[解决办法]
break_words 函数的docstring,可以通过该函数的“__doc__”属性访问。该方式相当于注释,但比普通的注释更强悍,访问者可通过该属性获取描述字符。

例如:
print(break_words.__doc__)

将打印:
this fuction will break up words for us.

热点排行