On 8/28/2009 3:45 AM hoffik wrote: > I'm quite new in Python and I have one question. I have a 2D matrix of > values stored in list (3 columns, many rows). I wonder if I can select one > column without having to go through the list with 'for' command.
Not quite what you asked but ... >>> rows = [(1, 5, 9), (2, 6, 10), (3, 7, 11), (4, 8, 12)] >>> cols = map(None,*rows) >>> cols [(1, 2, 3, 4), (5, 6, 7, 8), (9, 10, 11, 12)] Now you can have any "column" you want. Alan Isaac PS You can also use imap if you prefer not to create the list. -- http://mail.python.org/mailman/listinfo/python-list