Use accumulate from itertools:
list(itertools.accumulate(l_Of_l))
Out:
[[1],
[1, 2],
[1, 2, 3],
[1, 2, 3, 4],
[1, 2, 3, 4, 5],
[1, 2, 3, 4, 5, 6],
[1, 2, 3, 4, 5, 6, 7]]
More Related Contents:
- What is the difference between Python’s list methods append and extend?
- What is the syntax to insert one list into another list in python?
- Python extend with an empty list bug? [duplicate]
- How can I add tuples in a list? [closed]
- How can I randomly select an item from a list?
- How to split a string into a list of characters?
- List comprehension on a nested list?
- Python: Removing list element while iterating over list [duplicate]
- Converting a String to a List of Words?
- Check if something is (not) in a list in Python
- How to group a list of tuples/objects by similar index/attribute in python?
- How to force a list to a fixed size?
- What is the inverse function of zip in python? [duplicate]
- Pandas expand rows from list data available in column
- How to check if an object is a list or tuple (but not string)?
- How to remove all duplicate items from a list [duplicate]
- Unpack list to variables
- Python using enumerate inside list comprehension
- How to find common elements in list of lists?
- How to convert a string list into an integer in python [duplicate]
- Convert list of strings to dictionary
- Most efficient way for a lookup/search in a huge list (python)
- Sort list of strings by a part of the string
- How to make a completely unshared copy of a complicated list? (Deep copy is not enough)
- How can I partition (split up, divide) a list based on a condition?
- Python: Rename duplicates in list with progressive numbers without sorting list
- Loop through list with both content and index [duplicate]
- In Python, is there an elegant way to print a list in a custom format without explicit looping?
- Retrieve the two highest item from a list containing 100,000 integers
- Python find list lengths in a sublist