简体   繁体   中英

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]
>>> l=[[1,2,3,4],[5,6,7,8],[9,10,11,12]]
>>> x=[v[3] for v in l]
>>> x
[4, 8, 12]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM