I'm trying to implement in Python the following logic.
# Variable i = loop (1 to 32)
days = dict()
if i in days: # if there's already a Key in the dict
variable_time = str(days[i])
hours_time = variable_time .split(':')[0]
minutes_time = variable_time .split(':')[1]
# It should sum the current value to the new value
time_horizontal = timedelta(hours=int(hours_time), minutes=int(minutes_time))
total_horizontal[i] = time_horizontal + timedelta(hours=int(hours_), minutes=int(minutes_))
else:
# otherwise, it will insert the default values
total_horizontal[i] = timedelta(hours=int(hours_), minutes=int(minutes_)) # this will get info from other variables
With this code, I'm getting the following error:
Exception: Unexpected data type type 'datetime.timedelta'
How can I solve it? Thanks.