python3 日期时间

1 from datetime import datetime
2 
3 t1 = '22:21:30'
4 t2 = '23:21:25'
5 
6 s = datetime.striptime(t1, '%H:%M:%S')
7 e = datetime.striptime(t2, '%H:%M:%S')
8 
9 print((t2-t1).total_seconds()

 

posted @ 2020-03-15 08:59  程序猿Time  阅读(182)  评论(0编辑  收藏  举报