Python 소요시간 측정
-
[Python] 소요시간 측정방법Engineering WIKI/Python 2020. 12. 9. 19:28
import datetime start_time = datetime.datetime.now() # ( 측정을 하고자 하는 코드 ) end_time = datetime.datetime.now() elapsed_time = end_time - start_time 여기서 얻은 elapsed_time을 활용하여 millesecond 단위, microsecond 단위, second 단위로 결과 값을 얻을 수 있다. microsecond 단위 micro_elapsed_time = elapsed_time.microseconds millisecond 단위 ( 1 millisecond == 1000 microsecond ) ms_elapsed_time = elapsed_time.microseconds / 1000 sec..