3 回答

TA貢獻(xiàn)1802條經(jīng)驗(yàn) 獲得超10個(gè)贊
timeit.default_timer
timeit.timeit
from timeit import default_timer as timer start = timer()# ...end = timer()print(end - start) # Time in seconds, e.g. 5.38091952400282

TA貢獻(xiàn)1111條經(jīng)驗(yàn) 獲得超0個(gè)贊
只有Python 3:
time.perf_counter()
time.process_time()
time.clock()
:
import time t = time.process_time()#do some stuffelapsed_time = time.process_time() - t
process_time
添加回答
舉報(bào)