主要差别
(t1-t2).seconds
忽略微秒数,天数,返回两个时间点( (时分秒)-(时分秒) )的秒数差
(t1-t2).total_seconds
以微秒为精度,返回两个时间点之间的时间戳的差值
((年月日时分秒)-(年月日时分秒))
示例
import datetime
#年月日相同,时分秒不同
time1=datetime.datetime(2000,1,1,0,0,0)
time2=datetime.datetime(2000,1,1,1,1,1)
print((time2-time1).seconds)
print((time2-time1).total_seconds())
#输出
#3661
#3661.0
#年月日不同,时分秒不同
time1=datetime.datetime(2000,1,1,0,0,0)
time2=datetime.datetime(2000,1,2,1,1,1)
print((time2-time1).seconds)
print((time2-time1).total_seconds())
#输出
#3661
#90061.0