Calculating Time Difference

前端 未结 5 2008
情话喂你
情话喂你 2020-12-02 16:47

at the start and end of my program, I have

from time import strftime
print int(strftime(\"%Y-%m-%d %H:%M:%S\")



Y1=int(strftime(\"%Y\"))
m1=int(strftime(\         


        
5条回答
  •  攒了一身酷
    2020-12-02 17:30

    from time import time
    
    start_time = time()
    ...
    
    end_time = time()
    seconds_elapsed = end_time - start_time
    
    hours, rest = divmod(seconds_elapsed, 3600)
    minutes, seconds = divmod(rest, 60)
    

提交回复
热议问题