python – get list of tuples first index?

use zip if you need both

>>> r=(1,'one'),(2,'two'),(3,'three')
>>> zip(*r)
[(1, 2, 3), ('one', 'two', 'three')]

Leave a Comment