标签:fun col wrap span code pytho rap txt python
def my_decorator(txt=None): # 如果txt是str或int,则txt为带参修饰器 if isinstance(txt, (str, int)): def decorator(func): @wraps(func) def wrapper1(*args, **kwargs): # something ... return wrapper1 return decorator else: @wraps(txt) def wrapper2(*args, **kwargs): # do something ... return wrapper2
标签:fun col wrap span code pytho rap txt python
原文地址:https://www.cnblogs.com/ice5/p/14831144.html