Howto: extract a 'column' from a list of lists into a new list?

Lulu of the Lotus-Eaters mertz at
Tue Jul 1 03:33:20 CEST 2003

"Greg Brunet" <gregbrunet at> wrote previously:
|>>> tbl.Fields()
|[('STOCKNO', 'C', 8, 0), ('DACC', 'C', 5, 0), ('DEALERACCE', 'C', 30,
|0), ('D-ACCRTL', 'C', 9, 0), ('D-ACCCST', 'C', 9, 0)]

  NAME,TYPE,LEN,DEC = range(4)
  names = [row[NAME] for row in tbl.Fields()]

Keeping medicines from the bloodstreams of the sick; food from the bellies
of the hungry; books from the hands of the uneducated; technology from the
underdeveloped; and putting advocates of freedom in prisons.  Intellectual
property is to the 21st century what the slave trade was to the 16th.

More information about the Python-list mailing list