Re: locate items in matrix (index of lists of lists)

2009-03-20 Thread Chris Rebert
On Fri, Mar 20, 2009 at 7:28 AM, MRAB wrote: > Chris Rebert wrote: >> >> On Fri, Mar 20, 2009 at 4:34 AM, Alessandro Zivelonghi >> wrote: >>> >>> Many Thanks guys! >>> >>> and what if I need to look ONLY into the second and third columns, >>> excluding the first item of each rows? >>> >>> for exa

Re: locate items in matrix (index of lists of lists)

2009-03-20 Thread Alessandro Zivelonghi
this seems to work. Thanks! Alex x= 3 indices = [i for i, row in enumerate(mat) if x in row[1:]] 2009/3/20 Chris Rebert : > On Fri, Mar 20, 2009 at 4:34 AM, Alessandro Zivelonghi > wrote: >> Many Thanks guys! >> >> and what if I need to look ONLY into the second and third columns, >> excluding t

Re: locate items in matrix (index of lists of lists)

2009-03-20 Thread MRAB
Chris Rebert wrote: On Fri, Mar 20, 2009 at 4:34 AM, Alessandro Zivelonghi wrote: Many Thanks guys! and what if I need to look ONLY into the second and third columns, excluding the first item of each rows? for example if x = 3 I need to get [0] and not [0,1] indices = [i for i, row in enum

Re: locate items in matrix (index of lists of lists)

2009-03-20 Thread Chris Rebert
On Fri, Mar 20, 2009 at 4:34 AM, Alessandro Zivelonghi wrote: > Many Thanks guys! > > and what if I need to look ONLY into the second and third columns, > excluding the first item of each rows? > > for example if x = 3 I need to get  [0] and not [0,1] indices = [i for i, row in enumerate(mat) if

Re: locate items in matrix (index of lists of lists)

2009-03-20 Thread Alessandro Zivelonghi
Many Thanks guys! and what if I need to look ONLY into the second and third columns, excluding the first item of each rows? for example if x = 3 I need to get [0] and not [0,1] many thanks, Alex 2009/3/20 Tino Wildenhain : > Alexzive wrote: >> >> Hello there, >> >> let's suppose I have the fo

Re: locate items in matrix (index of lists of lists)

2009-03-20 Thread Tino Wildenhain
Alexzive wrote: Hello there, let's suppose I have the following matrix: mat = [[1,2,3], [3,2,4], [7,8,9], [6,2,9]] where [.. , .. , ..] are the rows. I am interested into getting the "row index" of all the matrix rows where a certain number occurs. For example for 9 I should get 2 and 3 (star

Re: locate items in matrix (index of lists of lists)

2009-03-20 Thread Chris Rebert
On Fri, Mar 20, 2009 at 3:50 AM, Alexzive wrote: > Hello there, > > let's suppose I have the following matrix: > > mat = [[1,2,3], [3,2,4], [7,8,9], [6,2,9]] > > where [.. , .. , ..] are the rows. > > I am interested into getting the "row index" of all the matrix rows > where a certain number occu

locate items in matrix (index of lists of lists)

2009-03-20 Thread Alexzive
Hello there, let's suppose I have the following matrix: mat = [[1,2,3], [3,2,4], [7,8,9], [6,2,9]] where [.. , .. , ..] are the rows. I am interested into getting the "row index" of all the matrix rows where a certain number occurs. For example for 9 I should get 2 and 3 (starting from 0). For