Indexing list of lists
David Eppstein
eppstein at ics.uci.edu
Tue Sep 16 16:43:11 EDT 2003
More information about the Python-list mailing list
Tue Sep 16 16:43:11 EDT 2003
- Previous message (by thread): Indexing list of lists
- Next message (by thread): Indexing list of lists
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
In article <95b4b9ac.0309161015.6a0567a7 at posting.google.com>, hildegarde_roth at yahoo.de (Hilde Roth) wrote: > This may have been asked before but I can't find it. If I have > a rectangular list of lists, say, l = [[1,10],[2,20],[3,30]], is > there a handy syntax for retrieving the ith item of every sublist? > I know about [i[0] for i in l] but I was hoping for something more > like l[;0]. >>> l = [[1,10],[2,20],[3,30]] >>> zip(*l)[0] (1, 2, 3) -- David Eppstein http://www.ics.uci.edu/~eppstein/ Univ. of California, Irvine, School of Information & Computer Science
- Previous message (by thread): Indexing list of lists
- Next message (by thread): Indexing list of lists
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list