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