将 x 秒的时间值添加到 HH:MM 的字符串变量时间

Adding x seconds worth of time onto a string variable time of HH:MM

我正在尝试找到一种方法来创建一个新变量 AUTOMATIC_END_TIME,该方法基于将最短时间添加到开始时间,但我无法找到允许 [=13] 的方法=] 变成时间,然后可以添加时间。

到目前为止我的脚本如下:

from time import sleep
from datetime import datetime, timedelta

START_TIME = "19:18"
END_TIME = "19:25"

LOGA = ["one", "two"]

TIME_DIFFERENCE = datetime.strptime(END_TIME, "%H:%M") - datetime.strptime(START_TIME, "%H:%M")
TIME_DIFFERENCE = TIME_DIFFERENCE.seconds

if len(LOGA) * (60 * (5 + 1)) >= TIME_DIFFERENCE:
    print "Show minimum end time"
    AUTOMATIC_END_TIME = "" # Should come out as 19:30

除了 AUTOMATIC_END_TIME 应该是 START_TIME + (60 * (5 + 1) 之外,当前脚本根本不应该改变 它应该是 19:30

>>> (datetime.strptime(START_TIME, "%H:%M") + timedelta(minutes=12)).strftime('%H:%M')
'19:30'
from time import sleep
from datetime import datetime, timedelta

START_TIME = "19:18"
END_TIME = "19:25"

LOGA = ["one", "two"]

TIME_DIFFERENCE = datetime.strptime(END_TIME, "%H:%M") - datetime.strptime(START_TIME, "%H:%M")
TIME_DIFFERENCE = TIME_DIFFERENCE.seconds

if len(LOGA) * (60 * (5 + 1)) >= TIME_DIFFERENCE:
    print "Show minimum end time"
    AUTOMATIC_END_TIME = (datetime.strptime(START_TIME, "%H:%M") + timedelta(minutes=12)).strftime('%H:%M')
    print AUTOMATIC_END_TIME