Let the array a
be:
a = [[1, 2], [1, 2, 3], [1, 2, 3, 4]]
How can one obtain the following list?
b = [[2], [2, 3], [2, 3, 4]]
Let the array a
be:
a = [[1, 2], [1, 2, 3], [1, 2, 3, 4]]
How can one obtain the following list?
b = [[2], [2, 3], [2, 3, 4]]
Well, for this example, you could use list comprehension with slicing.
a = [[1, 2], [1, 2, 3], [1, 2, 3, 4]]
b = [x[1:] for x in a]