Reach_Down
Reach_Down

Reputation: 1

Get every nth item in list inside of another list

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

Answers (1)

yu_sha
yu_sha

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

Related Questions