python 复习之 函数返回值
1. python中返回值的类型,当然还可以组成其他的类型
tuple
def returnValue(a,b):
c = a+b
return (a,b,c)
x,y,z = returnValue(1,2)
print 'x:',x,'y:',y,'z:',z
list
def returnValue(a,b):
c = a+b
return [a,b,c]
x = returnValue(1,2)
print x
dict
def returnValue(a,b):
c = a+b
return {a:c,b:c}
x = returnValue(1,2)
print x
一个不会敲代码的程序员

浙公网安备 33010602011771号