Take a 2d list.
I want to make a new list with only the ith element from each list.
What is the best way to do this?
I have:
map(lambda x: x[i], l)
Here is an example
>>> i = 0
>>> l = [[1,10],[2,20],[3,30]]
>>> map(lambda x: x[i], l)
[1, 2, 3]
Use list comprehension:
Also see this question on list comprehension vs. map.