#!/usr/bin/env python # -*- conding: utf-8 -*- # author caoyx #@time : import time #函数即变量 def timer(func): def deco(): start_time = time.time() func() stop_time = time.time() print ("the func run time is %s" % (stop_time-start_time)) return deco #deco() @timer def test(): time.sleep(3) print ("in the test ") test()