#!/usr/bin/env python def deco(func1): #define a decorate function deco def wrapper(): print"Hello Python!" func() print"I am Profero!" return wrapper @deco #use @deco call def func2(): #define func2 print"What's your name? " func2 #call func2 # The result: Hello Python! What's your name? I am Profero!
python 装饰器
原创VictorFeng1 ©著作权
文章标签 高端大气上档次的python装饰器 文章分类 Python 后端开发
下一篇:python 装饰器
-
常用的10个Python装饰器
python中常用的10个装饰器
python 装饰器 py装饰器