Python入门系列教程(五)函数

全局变量

修改全局变量

a=100
def test():
    global  a
    a=200
    print a

多个返回值

Python入门系列教程(五)函数

缺省参数

def test3(a,b=1):
    print  a,b

test3(a)
test3(a,b=2)

不定长参数

Python入门系列教程(五)函数