函数返回值

# -*- coding: utf-8 -*-
def test1():
print("test1返回值")

def test2():
print("test2返回值")
return 0

def test3():
print("test3返回值")
return 1,["a","b","c"],{"name":"何小六"}

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


print(y)
print(z)

#总结:
# 返回值数=0,返回None
#返回值数=1,返回object(对象本身)
#返回值数>1,返回tuple(元组)

猜你喜欢

转载自www.cnblogs.com/hekaiqiaq/p/8855819.html