time_interval = [4, 6, 12]
I want to sum up the numbers like [4, 4+6, 4+6+12] in order to get the list t = [4, 10, 22].>
[4, 4+6, 4+6+12]
t = [4, 10, 22]
Try this: accumulate function, along with operator add performs the running addition.
import itertools import operator result = itertools.accumulate([1,2,3,4,5], operator.add) list(result)