#我的小記_初學python之裝飾器的實現
import time
import os
def timeit(func):
def wrapper():
start = time.clock()
func()
end = time.clock()
print(end - start)
return wrapper
@timeit
def hello():
print('hello')
hello()
os.system("pause")
#我的小記_初學python之裝飾器的實現
import time
import os
def timeit(func):
def wrapper():
start = time.clock()
func()
end = time.clock()
print(end - start)
return wrapper
@timeit
def hello():
print('hello')
hello()
os.system("pause")