# flag = False # 一开始没有登录
#
# def login(): # 函数:对功能或者动作的封装
# global flag
# username = input("请输入你的用户名:")
# password = input("请输入你的密码:")
#
# with open("userinfo",mode="r", encoding="utf-8") as f:
# for line in f:
# dic = eval(line.strip()) # {"username":"wusir1", "password":"sb"}
# if username == dic['username'] and password == dic['password']:
# print("登录成功")
# flag = True
# break
# else:
# print('登录失败')
# flag = False
#
#
# def wrapper(fn):
# def inner(*args, **kwargs):
# count = 0
# while count < 3:
# if flag == True:
# ret = fn(*args, **kwargs)
# return ret
# else: # 没登录
# login()
# count += 1
# return inner
#
# @wrapper
# def func():
# print("今天星期一. 你们啥时候睡觉啊")
#
#
# func()
# func()
转载于:https://www.cnblogs.com/bpbl/p/10209225.html