Re: [Tutor] Using lists as table-like structure

2005-11-17 Thread Bernard Lebel
Thanks to everyone for the answers. I'll definitely check Numeric Python. Cheers Bernard On 11/16/05, Danny Yoo <[EMAIL PROTECTED]> wrote: > > > On Wed, 16 Nov 2005, Bernard Lebel wrote: > > > Let say I have a list of lists. Each individual lists have a bunch of > > elements. Now I would like

Re: [Tutor] Using lists as table-like structure

2005-11-16 Thread Danny Yoo
On Wed, 16 Nov 2005, Bernard Lebel wrote: > Let say I have a list of lists. Each individual lists have a bunch of > elements. Now I would like to either get or set the first element of > each individual list. I could do a loop and/or list comprehension, but I > was wondering if it was possible w

Re: [Tutor] Using lists as table-like structure

2005-11-16 Thread Alan Gauld
> But as soon as I introduce the [0], in an attempt to access the first > element of each sublist, I get the first sublist in its entirety: > aList[:][0] > [1, 1, 1] aList[:] is the shorthand way of taking a copy of aList thus aList[:][0] is the same as saying aList[0] except you get a new

Re: [Tutor] Using lists as table-like structure

2005-11-16 Thread Fred Lionetti
Hi Bernard, You can do this with Numeric (http://numeric.scipy.org/) import Numeric aList = [ [1,1,1], [2,2,2,], [3,3,3] ] bList = Numeric.array(aList, "i") print bList[:,0] displays-> [1 2 3] you can convert the array back to a list if you want like this: bList.tolist() so... result = Numeri

[Tutor] Using lists as table-like structure

2005-11-16 Thread Bernard Lebel
Hello, I am wondering if can do this: Let say I have a list of lists. Each individual lists have a bunch of elements. Now I would like to either get or set the first element of each individual list. I could do a loop and/or list comprehension, but I was wondering if it was possible with something