1、定义:对于函数中的多个返回数据,例如元组、列表或者字典,直接获取里面数据的过程
2、例子:
def test():
return 10,20,30
res = test()
print(type(res))
a,b,c = res
print(a,b,c)
# 对list拆包
a = [1,2,3,4]
a1,*a2,a3=a
print(a1,a2,a3)
#对字典拆包,只会对字典中的key进行拆
dic = {"name":"wushuang","age":30,"sex":"1","school":"xx"}
name,*other,school=dic
print(name,other,school)