函数闭包补充:解压序列 一、 l = [10,19,2,3,5,90] a,*_,c = l a #此处为dos环境中回车,后面雷同 10 c 90 运用序列一一对应关系 etc: a,b,c = (1,2,3) a 1 b 2 c 3 etc: a,b,c = 'hel' a 'h' b 'e' c 'l' 数值交换 a = 1 b = 2 a,b = b,a #将a,b值已经交换 装饰器作业: def auth_func(func): def wrapper(*args,**kwargs): username = input('用户名:') password = input('密码:') if username == 'alex' and password == '1234': res = func(*args,**kwargs) return res else: print('用户名或者密码错误') return wrapper @auth_func(func) def index(name): print('fastly hello jindon!') @auth_func(func) def shopping_car(name): print('%s的购物车里面有[%s,%s]',%(name,'xiezi',''wazi))