您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

《python基础教程》笔记之抽象

2024/3/6 14:12:46发布18次查看
创建函数
记录函数,在函数的开头写下字符串,它就会作为函数的一部分进行存储,这称为文档字符串,如
def square(x):    'caculates the square of the number x.'
   return x*x
>>> square.__doc__
'caculates the square of the number x.'
help -- 在交互式解释器中使用会得到关于函数包括它的文档字符串的信息,如
>>> help(square)
help on function square in module __main__:
square(x)
    caculates the square of the number x.
所有的函数都返回了东西:当不需要它们返回值的时候,它们就返回none。
参数魔法
 以上就是《python基础教程》笔记之抽象的内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product