05 2016 档案

摘要:函数 def sayHi(): print 'Hi' def cheng(a,b): return a*b print cheng(3,4) 局部变量:函数内部定义,函数调用结束后释放 全局变量:函数内外都可调用,global >>> def hanshu2():... global x #x为全局 阅读全文
posted @ 2016-05-15 00:40 麦穗儿 阅读(202) 评论(0) 推荐(0)
摘要:元组tuple #只能初次赋值,不能更改和删除 #支持切片 >>> a(1, 2, 3, 4, 5, 6, 7, 8, 9)>>> a [0:6:2](1, 3, 5) type((1,))#tuple type((1)) # int 元组可做格式化输出 >>> print '这个数%f' % (5 阅读全文
posted @ 2016-05-04 22:56 麦穗儿 阅读(149) 评论(0) 推荐(0)