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()