
Possible Math Problem
Working on a program and I need to get timestamps. In order to get the timestamps I have to convert them from one string to a string of 0's and 1's. The length of the 0's and 1's is 1440 (number of minutes in a day). As a short example, 001001, the 1's correspond to the minute of the day it occurred thus these would be 00:03 and 00:06. Any thoughts on how I could take the place of the 1's (in the example 2 and 5) and convert that so it would appear as 00:03 and 00:06? I figure there should be some sort of math I could do so that when I get a 1 at place 937 I can easily convert it to the time.

Loop through string until it finds a 1. Find which spot in the string it is. Use that number and divide by 60. Use that result's whole number as the hours. Then use the "%" operator in Python to find the remaining minutes. 68 % 60 = 8. Stick a ":" in the middle of the two results.
Guessing there is someway to put a 0 in front the numbers if the result on either side of the ":" is less than 10 too.

You are the man! Pretty sure this will work!

for i, ltr in enumerate(working_value):
if ltr == '1':
hour = i // 60
min = i % 60
time = str("{0:0>2}".format(hour)) + ":" + str("{0:0>2}".format(min))
This was the code I wrote and it worked perfectly! Thanks again NetworkNewb!