python3 获取两个时间戳相差多少秒
2021-01-26 19:13
标签:date control puts seconds pre print mes code cond code outputs python3 获取两个时间戳相差多少秒 标签:date control puts seconds pre print mes code cond 原文地址:https://www.cnblogs.com/sea-stream/p/12851675.htmlimport time
import datetime
t1=time.time()
time.sleep(5)
t2=time.time()
print("相差",(datetime.datetime.fromtimestamp(t2)-datetime.datetime.fromtimestamp(t1)).seconds,"秒")
macname@MacdeMBP Desktop % python3 test.py
相差 5 秒
macname@MacdeMBP Desktop %
上一篇:JAVA各种加密与解密方式
文章标题:python3 获取两个时间戳相差多少秒
文章链接:http://soscw.com/index.php/essay/47400.html