First items in inner list efficiently as possible [duplicate]

This should do it:

c = [x[0] for x in A]

It’s a list comprehension that takes the first (sub-)element of every element of A.

Leave a Comment