Dec-21-2022, 06:44 AM
Greetings to those that are still up!
I'm trying to sum up set elements:
HH:MM:SS
I can do that if the HH:MM:SS elements are in the list but fail if the elements are in the SET.
Here is what I got so far:
Any help is appreciated.
Thank you.
I'm trying to sum up set elements:
HH:MM:SS
I can do that if the HH:MM:SS elements are in the list but fail if the elements are in the SET.
Here is what I got so far:
import datetime
add_time = ['00:00:15', '0:15:15', '5:15:15']
#add_time = set("00:00:15", "0:15:15", "5:15:15")
add_time = datetime.timedelta()
for i in add_time:
(h, m, s) = i.split(':')
d = datetime.timedelta(hours=int(h), minutes=int(m), seconds=int(s))
add_time += d
print(f" --- {str(add_time)}")[python][/python]Any help is appreciated.
Thank you.
