Python

[Python] 실행시간 측정하기

김먼저 2023. 9. 7. 15:53

 

 

from time import time

t1 = time()

# ------- 측정할 로직 ---------

t2 = time()
cost_time = t2 - t1
hours, rem = divmod(cost_time, 3600)
minutes, seconds = divmod(rem, 60)
logger.info(f'cost time : {int(hours):02d}:{int(minutes):02d}:{int(seconds):02d}')

 

 

cost time : 01:23:45