Python装饰器

1.最简单的例子

 1 #coding:utf8
 2 
 3 def b(z):
 4     print u'装饰器'
 5     def func(*args,**kw):
 6         print '111'
 7         return z(*args,**kw)
 8     return func
 9 
10 @b
11 def a(x):
12     print x
13     print u'函数A'
14 
15 a('y')
原文地址:https://www.cnblogs.com/qqzj/p/6663935.html