Python学习 Part2:深入Python函数定义
摘要:
在Python中,可以定义包含若干参数的函数,这里有几种可用的形式,也可以混合使用:1. 默认参数最常用的一种形式是为一个或多个参数指定默认值。>>> def ask_ok(prompt,retries=4,complaint='Yes or no Please!'): while True: ok=input(prompt) if ok in ('y','ye','yes'): return True if ok in ('n','no','nop','n 阅读全文
posted @ 2013-10-12 17:20 LilianChen 阅读(7550) 评论(1) 推荐(1) 编辑