I want to get all the time between start time and end time in python, so I was using for loop with range function.
There are 2 variables, a
and b
which have time in %H:%M:%S
format.
These 2 variables are start and end time and I want to print all the time between the start and end time.
import datetime
from datetime import datetime
import time
a = '20:15:16'
b = '20:32:55'
a = datetime.strptime(a,'%H:%M:%S').time()
b = datetime.strptime(b,'%H:%M:%S').time()
for i in range(a,b):
print(i)
For this I am getting an error - datetime.time' object cannot be interpreted as an integer
.
I want to print all the time between a
and b
.