摘要:
Python函数没有明显的begin和end,没有标明函数的开始和结束的花括号。唯一的分隔符是一个冒号 (:),接着代码本身是缩进的。例如:def buildConnectionString(params): """Build a connection string from a dictionary of parameters. Returns string.""" return ";".join(["%s=%s" % (k, v) for k, v in params.items()])其实 阅读全文
posted @ 2013-10-05 19:34
不喝啤酒的小啤酒
阅读(3990)
评论(0)
推荐(0)
摘要:
1.def (define的前三个字母)是一个关键字,用来声明函数。2.def 声明函数的格式为:def 函数名(参数1,参数2,...,参数n): 函数体例如:def fib(n): print 'n =', n if n > 1: return n * fib(n - 1) else: print 'end of the line' return 13.函数返回值类型不固定,声明函数时不需要指... 阅读全文
posted @ 2013-10-05 14:20
不喝啤酒的小啤酒
阅读(36231)
评论(0)
推荐(0)
摘要:
早就想学习这个语言了,不过一直无从下手,趁十一放假,想入入门,并想把学习的经历记录下来,以做备忘。Python学习笔记之疑问 4:什么是模块Python学习笔记之疑问 3:''' 三重引号(three double-quotes)的作用Python学习笔记之疑问 2:python的函数定义为什么没有开始和结束符Python学习笔记之疑问 1:def 是什么意思学习资源:1.深入 Python :Dive Into Python 中文版http://woodpecker.org.cn/diveintopython/toc/index.htmlhttp://woodpeck 阅读全文
posted @ 2013-10-05 13:57
不喝啤酒的小啤酒
阅读(455)
评论(0)
推荐(0)