ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> python-list
python-list
Re: Howto: extract a 'column' from a list of lists into a new list?
by Greg Brunet other posts by this author
Jul 1 2003 2:22AM messages near this date
Re: Howto: extract a 'column' from a list of lists into a new list? | Identity inconsistency and unification of types and classes
"Egor Bolonev" <ebolonev@[...].ru>  wrote in message
news:bdqp9e$7r$1@[...]..

>  =============================================
>  a=[('STOCKNO', 'C', 8, 0), ('DACC', 'C', 5, 0), ('DEALERACCE', 'C',
30,
>  0), ('D-ACCRTL', 'C', 9, 0), ('D-ACCCST', 'C', 9, 0)]
> 
>  b=[x[0] for x in a]         # :-) Python is cool!
> 
>  print b
>  =============================================
> 
>  As I know the map/lamda/list works very slow and you should use it
'only'
>  with SCRIPTS.

Thanks Egor!

It looks like I was closer than I thought - but still would have been
unlikely to figure it out!

-- 
Greg

-- 
http://mail.python.org/mailman/listinfo/python-list

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved