发布时间:2019-08-26 07:21:34编辑:auto阅读(2385)
计算两个时间点之间的时间间隔,可使用以下方法:
参考 https://docs.python.org/3/library/datetime.html#module-datetime
import datetime
starttime = datetime.datetime.now()
#long running
endtime = datetime.datetime.now()
duringtime = endtime - starttime
print duringtime.seconds
两者相减,得到的duringtime是一个timedelta的实例,这个实例自身有属性有
days
seconds
microseconds
import time
a = time.time()
# short running
b = time.time()
seconds = b - a
m, s = divmod(seconds, 60)
h, m = divmod(m, 60)
print ("%02d:%02d:%02d" % (h, m, s))
参考:
https://www.jianshu.com/p/03d6e9867fdf
https://blog.csdn.net/xiaoQL520/article/details/78435175
上一篇: python使用dom操作xml
下一篇: Python 3.x基于Xml数据的Ht
52665
52579
42716
39594
33984
30948
29740
24628
24471
22854
195°
209°
270°
263°
295°
449°
433°
445°
519°
443°