python - get list of tuples first index?
list, python, tuples
Solution
use zip if you need both
>>> r=(1,'one'),(2,'two'),(3,'three')
>>> zip(*r)
[(1, 2, 3), ('one', 'two', 'three')]
Problem
What's the most compact way to return the following: Given a list of tuples, return a list consisting of the tuples first (or second, doesn't matter) elements. For: ``` [(1,'one'),(2,'two'),(3,'three')] ``` returned list would be ``` [1,2,3] ```