原始链接:https://www.cnblogs.com/amyzhu/p/10224649.html
[python]函数返回多个return值
python支持函数直接返回多个变量,具体用法如下:
>>> def test():
... a=2
... b=3
... return a,b
...
>>> print(test())
(2, 3)
>>> a,b=test()
>>> print(a)
2
>>> print(b)
3
>>> print(test()[0])
2
>>> print(test()[1])
3
最后
以上就是笑点低舞蹈最近收集整理的关于转载:python return多个值[python]函数返回多个return值的全部内容,更多相关转载:python内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复