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
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
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
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
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