码迷,mamicode.com
首页 > 编程语言 > 详细

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

时间:2018-03-07 00:56:41      阅读:169      评论:0      收藏:0      [点我收藏+]

标签:post   color   int   func   rgs   col   print   pos   nbsp   

 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)

 

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

标签:post   color   int   func   rgs   col   print   pos   nbsp   

原文地址:https://www.cnblogs.com/hank-lkj/p/8519754.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!