标签:put 购物车 else ret rip war 特殊 str 输入
u={"n":None,"l":False} def gaojie(func): def yin(*args,**kwargs): if u["n"] and u["l"]: res=func(*args,**kwargs) return res name=input("请输入用户名").strip() passwd=input("请输入密码").strip() if name =="sb" and passwd=="123": u["n"]= name u["l"]= True res=func(*args,**kwargs) return res else: print("用户名或密码输入有误") return yin @gaojie def index(): print("欢迎来到京东") @gaojie def home(): print("欢迎回家") @gaojie def shopping(name): print("%s的购物车里有好多东西:例如[%s,%s,%s]" %(name,"手机","洗衣机","电视机")) index() home() shopping("董文辉")
标签:put 购物车 else ret rip war 特殊 str 输入
原文地址:https://www.cnblogs.com/1304379017dwh/p/9123902.html