Measuring elapsed time with the Time module

前端 未结 10 869
执念已碎
执念已碎 2020-12-02 03:13

With the Time module in python is it possible to measure elapsed time? If so, how do I do that?

I need to do this so that if the cursor has been in a widget for a c

10条回答
  •  悲哀的现实
    2020-12-02 04:01

    time.time() will do the job.

    import time
    
    start = time.time()
    # run your code
    end = time.time()
    
    elapsed = end - start
    

    You may want to look at this question, but I don't think it will be necessary.

提交回复
热议问题