List comprehension list of lists

Solution 1:

Use this:

[[number+1 for number in group] for group in x]

Or use this if you know map:

[map(lambda x:x+1 ,group) for group in x]

Solution 2:

Starting from the structure of your data:

x = [[1,2,3],[4,5,6],[7,8,9]]

Every group is a triplet [a,b,c], so I consider for readability a solution like:

«take every group [a,b,c] from the list and provide me the list of [a+1,b+1,c+1] »

x_increased = [ [a+1,b+1,c+1] for [a,b,c] in x ]