Python心得基础篇【10】装饰器

 1 def outer(func):
 2     def inner(*arg, **kwargs):
 3         print('123')
 4         ret = func(*arg, **kwargs)
 5         print('112233')
 6         return ret
 7     return inner
 8 
 9 
10 def home(s1, s2):
11     return 'home'
12 
13 
14 def show(s1, ss):
15     return 'show'
16 
17 @outer
18 def f1(arg):
19     print('F1')
20 
21 
22 
23 def f2(a1, a2, a3):
24     print('F2')
25     return
26 f1([1])
27 f2(1,2,3)
原文地址:https://www.cnblogs.com/hank-lkj/p/8519754.html