from datetime import datetime, timedelta
def get_interval (inicio, fim, intervalo):
"""
Retorna a lista de horários entre `inicio` e `fim`, inclusive, com um intervalo definido por `intervalo`.
@param inicio iterable Lista de três valores no formato (hora, minutos, segundos)
@param fim iterable Lista de três valores no formato (hora, minutos, segundos)
@param intervalo iterable Lista de três valores no formato (hora, minutos, segundos)
@return generator
"""
inicio = datetime(2017, 1, 1, *inicio)
fim = datetime(2017, 1, 1, *fim)
iHoras, iMinutos, iSegundos = intervalo
intervalo = timedelta(hours=iHoras, minutes=iMinutos, seconds=iSegundos)
while inicio <= fim:
yield inicio.time()
inicio += intervalo
hrInicial = (8, 0, 0)
hrFinal = (12, 0, 0)
intervalo = (0, 30, 0)
for hora in get_interval(hrInicial, hrFinal, intervalo):
print(hora)
ZnJvbSBkYXRldGltZSBpbXBvcnQgZGF0ZXRpbWUsIHRpbWVkZWx0YQoKZGVmIGdldF9pbnRlcnZhbCAoaW5pY2lvLCBmaW0sIGludGVydmFsbyk6CiAgICAKICAgICIiIiAKICAgIFJldG9ybmEgYSBsaXN0YSBkZSBob3LDoXJpb3MgZW50cmUgYGluaWNpb2AgZSBgZmltYCwgaW5jbHVzaXZlLCBjb20gdW0gaW50ZXJ2YWxvIGRlZmluaWRvIHBvciBgaW50ZXJ2YWxvYC4KICAgIAogICAgQHBhcmFtIGluaWNpbyAgICBpdGVyYWJsZSBMaXN0YSBkZSB0csOqcyB2YWxvcmVzIG5vIGZvcm1hdG8gKGhvcmEsIG1pbnV0b3MsIHNlZ3VuZG9zKQogICAgQHBhcmFtIGZpbSAgICAgICBpdGVyYWJsZSBMaXN0YSBkZSB0csOqcyB2YWxvcmVzIG5vIGZvcm1hdG8gKGhvcmEsIG1pbnV0b3MsIHNlZ3VuZG9zKQogICAgQHBhcmFtIGludGVydmFsbyBpdGVyYWJsZSBMaXN0YSBkZSB0csOqcyB2YWxvcmVzIG5vIGZvcm1hdG8gKGhvcmEsIG1pbnV0b3MsIHNlZ3VuZG9zKQogICAgQHJldHVyb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