Reputation: 1
I have a list that consists of another list of values id, start, finish, value. I am looking to get an array that is filled with just the values. How can I do this in python?
Example list:
[[id, start, finish, value], [id, start, finish, value], [id], [start], [finish], [value]]
Want:
[value, value, value]
Upvotes: 0
Views: 48
Reputation: 4410
>>> l=[[1,2,3,4],[5,6,7,8],[9,10,11,12]]
>>> x=[v[3] for v in l]
>>> x
[4, 8, 12]
Upvotes: 4