例:
>>> def test():
a=11
b=22
c=33
return a #多個return,語法不會報錯,但是隻執行第一個return
return b #不會執行此條語句
return c #不會執行此條語句
>>> num=test()
>>> num
11
要想獲得多個返回值,可以用列表或元組封裝
>>> def test():
a=11
b=22
c=33
return [a,b,c]
>>> num=test()
>>> num
[11, 22, 33]
>>> def test():
a=11
b=22
c=33
return a,b,c
>>> num=test()
>>> num
(11, 22, 33)
>>> def test():
a=11
b=22
c=33
return (a,b,c)
>>> num=test()
>>> num
(11, 22, 33)