How to get first element in a list of tuples?

>>> a = [(1, u'abc'), (2, u'def')]
>>> [i[0] for i in a]
[1, 2]

Leave a Comment