函数返回值

def test1():
print('in the test1')
def test2():
print('in the test2')
return 0
def test3():
print('in the test3')
return 1,'hello',['alex','wupeiqi'],{'name':'alex'}
#return test2#返回test2内存地址

x=test1()
y=test2()
z=test3()
print(x)
print(y)
print(z)

in the test1
in the test2
in the test3
None
0
(1, 'hello', ['alex', 'wupeiqi'], {'name': 'alex'})

原文地址:https://www.cnblogs.com/rongye/p/9914412.html