📜  如何在python代码示例中添加两个不同的时间

📅  最后修改于: 2022-03-11 14:45:27.178000             🧑  作者: Mango

代码示例1
import datetime as dt
t1 = dt.datetime.strptime('12:00:00', '%H:%M:%S')
t2 = dt.datetime.strptime('02:00:00', '%H:%M:%S')
time_zero = dt.datetime.strptime('00:00:00', '%H:%M:%S')
print((t1 - time_zero + t2).time())