发布时间:2019-08-26 07:21:34编辑:auto阅读(2152)
计算两个时间点之间的时间间隔,可使用以下方法:
参考 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
51311
50762
41358
38166
32642
29537
28382
23256
23225
21550
1624°
2357°
1959°
1905°
2236°
1944°
2635°
4417°
4259°
3030°