高阶函数
import time def bar(): time.sleep(3) print('in the bar') def test1(func): start_time=time.time() # print(func) func() stop_time=time.time() print('the func is %s' %(stop_time-start_time)) test1(bar) 执行结果: in the bar the func is 3.000213623046875