How do I get time of a Python program's execution?

后端 未结 30 2108
甜味超标
甜味超标 2020-11-22 02:20

I have a command line program in Python that takes a while to finish. I want to know the exact time it takes to finish running.

I\'ve looked at the timeit

30条回答
  •  执念已碎
    2020-11-22 02:41

    There is a timeit module which can be used to time the execution times of Python code.

    It has detailed documentation and examples in Python documentation, 26.6. timeit — Measure execution time of small code snippets.

提交回复
热议问题