标签:return int class blog after highlight module python name
def deco(arg): #装饰器的参数 def _deco(func): #函数名 def __deco(x): #函数的参数 print("before %s called [%s]." % (func.__name__, arg)) s = func(x) print("after %s called [%s]." % (func.__name__, arg)) return s return __deco return _deco @deco("module") def myfunc(x): print("myfunc() called.") return x ** 2 s = myfunc(14) print(s) # before myfunc called [module]. # myfunc() called. # after myfunc called [module]. # 196
标签:return int class blog after highlight module python name
原文地址:http://www.cnblogs.com/yangxiaoling/p/6901581.html