标签:
代码:
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# author by lh
def outer(func):
def inner(*arg,**kwargs):
print ‘hello‘
r=func(*arg,**kwargs)
print ‘end‘
return r
return inner
def outer0(func):
def inner(*arg,**kwargs):
print ‘Welcome‘
r=func(*arg,**kwargs)
return r
return inner
@outer
@outer0
def f1(a1,a2):
print ‘F1‘
f1(1,2)
@outer
def f2(a1,a2,a3):
print ‘F2‘
f2(1,2,3)
运行结果:
标签:
原文地址:http://www.cnblogs.com/pythonlh/p/5764580.html