带参数的函数增加装饰器:
# !/usr/bin/env python
# -*- coding: utf-8 -*-
import time
def tips(func):
def nei(a,b):
print 'start'
func(a,b)
print 'stop'
return nei
@tips
def add(a,b):
print a+b
print add(11,22)
C:\Python27\python.exe C:/Users/TLCB/PycharmProjects/untitled2/socket/fun6.py
start
33
stop
None
Process finished with exit code 0