Re: [Tutor] what's a concise way to print the first elements in a nested list

2005-01-12 Thread Orri Ganel
Danny Yoo wrote: On Wed, 12 Jan 2005, Orri Ganel wrote: >>> stuff = [[0,'sdfsd','wrtew'], [1, 'rht','erterg']] >>> stuff [[0, 'sdfsd', 'wrtew'], [1, 'rht', 'erterg']] >>> print [stuff[i][0] for i in range(len(stuff))] [0, 1] Hi Orri, An alternative way to write th

Re: [Tutor] what's a concise way to print the first elements in a nested list

2005-01-12 Thread Danny Yoo
On Wed, 12 Jan 2005, Orri Ganel wrote: > >>> stuff = [[0,'sdfsd','wrtew'], [1, 'rht','erterg']] > >>> stuff > [[0, 'sdfsd', 'wrtew'], [1, 'rht', 'erterg']] > >>> print [stuff[i][0] for i in range(len(stuff))] > [0, 1] Hi Orri, An alternative way to write this is: ### print [row[0] for row

Re: [Tutor] what's a concise way to print the first elements in a nested list

2005-01-12 Thread jfouhy
Quoting Vincent Wan <[EMAIL PROTECTED]>: > If I have a list stuff = [[0,sdfsd,wrtew], [1, rht,erterg]] whats the > most concise way to print the first elements: > > [0, 1] > > if tried print stuff[:][0] but that just prints the whole list. List comprehension will do it: >>> stuff = [ [ 0, "sd

Re: [Tutor] what's a concise way to print the first elements in a nested list

2005-01-12 Thread Orri Ganel
Vincent Wan wrote: If I have a list stuff = [[0,sdfsd,wrtew], [1, rht,erterg]] whats the most concise way to print the first elements: [0, 1] if triedprint stuff[:][0] but that just prints the whole list. Vincent

[Tutor] what's a concise way to print the first elements in a nested list

2005-01-12 Thread Vincent Wan
If I have a list stuff = [[0,sdfsd,wrtew], [1, rht,erterg]] whats the most concise way to print the first elements: [0, 1] if triedprint stuff[:][0] but that just prints the whole list. Vincent -- PhD Cand