标签:use start pre port int fun time sleep return
# _*_coding:utf-8_*_
# Author:len liu
import time
def bar():
# start_time=time.time()
time.sleep(1)
print(‘in the bar‘)
# stop_time=time.time()
# print(‘use time %s ‘ %use_time) #bar() -------------->
#in the bar
#use time 1.000830888748169
def timer(fun):
def add_use_time():
start_time=time.time()
fun()
stop_time=time.time()
print(‘use time %s ‘ %(stop_time - start_time))
return add_use_time
bar=timer(bar)
bar()
#--------------> #in the bar
#use time 1.000830888748169
标签:use start pre port int fun time sleep return
原文地址:https://www.cnblogs.com/len1028/p/9320661.html