- #让函数返回元组
- >>> def myfunction(a):
- return (a+1,a*2,a*a)
- >>> print myfunction(3)
- (4, 6, 9)
- #同时你也通过元组接收返回值,并存放在不同的变量里
- >>> (a,b,c) = myfunction(3)
- >>> print b
- 6
- >>> print c
- 9
- #该片段来自于http://www.codesnippet.cn/detail/100120131486.html
来源: http://www.codesnippet.cn/detail/100120131486.html