I have an array of integers with data in seconds like: time = (900,1800,2700,...) and would like to convert it into an array with the following format: time_new = (hh:mm,hh:mm,...)
Figured it out, below is how I fixed the data:
def convert(seconds):
seconds = seconds % (24 * 3600)
hour = seconds // 3600
seconds %= 3600
minutes = seconds // 60
seconds %= 60
return "%d:%02d" % (hour, minutes)
time = []
for i in range(size_of_time):
time.append(str(convert(times[i])))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.