First, this code could not output 00:00:35
, as frames_load=0
initially.
Second, error says it all, you can't add timedelta, i.e. end['timestamp'] - start['timestamp']
, to integer, that is to 0
.
If you want sum up cumulative timedelta, you should init frames_load=timedelta()
. Or following code will do the trick:
times_start_dict = [{'timestamp': datetime(2013, 12, 21, 4, 36, 23)},
{'timestamp': datetime(2013, 12, 21, 4, 36, 23)}]
times_end_dict = [{'timestamp': datetime(2013, 12, 21, 4, 36, 25)},
{'timestamp': datetime(2013, 12, 21, 4, 36, 26)}]
print sum((end['timestamp'] - start['timestamp']
for start, end in zip(times_start_dict, times_end_dict)),
timedelta())
# 0:00:05