#!/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!
本文出自 “10641692” 博客,请务必保留此出处http://10651692.blog.51cto.com/10641692/1711890
原文地址:http://10651692.blog.51cto.com/10641692/1711890