发布时间:2019-08-26 07:21:34编辑:auto阅读(1928)
计算两个时间点之间的时间间隔,可使用以下方法:
参考 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
48901
47985
38759
35892
30319
27088
26099
20934
20752
19113
594°
671°
662°
668°
640°
611°
692°
756°
883°
1043°