4 Jul
2005
4 Jul
'05
10:11 a.m.
Henning.Ramm@mediapro-gmbh.de schrieb:
Ahoi!
Ich brauche aus einer Liste von Listen oder Tupeln (z.B. zurückgegeben von cursor.fetchall) jeweils nur das erste Element. Lässt sich das sinnvoller schreiben als: neueliste = map(lambda x: x[0], alteliste)
Ab Python 2.2: neueliste = [ x[0] for x in alteliste ] Ab Python 2.4 auch al Generator: neueliste = ( x[0] for x in alteliste ) -- Schönen Gruß - Regards Hartmut Goebel | Hartmut Goebel | IT-Security -- effizient | | h.goebel@goebel-consult.de | www.goebel-consult.de | _______________________________________________ python-de maillist - python-de@python.net http://python.net/mailman/listinfo/python-de