def logger(text): # text是一个tuple def decorator(func): @functools.wraps(func) def wrapper(args, **kw): if len(text) == 0: print("{0}():".format(func.name)) else: print('%s %s():' % (text, func.name))
# print(list(text)) return func(*args, **kw) return wrapper return decorator
Sign in to make a reply
不帅中二的猫先生
def logger(text): # text是一个tuple def decorator(func): @functools.wraps(func) def wrapper(args, **kw): if len(text) == 0: print("{0}():".format(func.name)) else: print('%s %s():' % (text, func.name))