locate items in matrix (index of lists of lists)
zasaconsulting at gmail.com
Fri Mar 20 17:06:36 CET 2009
this seems to work. Thanks!
indices = [i for i, row in enumerate(mat) if x in row[1:]]
2009/3/20 Chris Rebert <clp2 at rebertia.com>:
> On Fri, Mar 20, 2009 at 4:34 AM, Alessandro Zivelonghi
> <zasaconsulting at gmail.com> 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  and not [0,1]
> indices = [i for i, row in enumerate(mat) if 1<= i <= 2 and 3 in row[1:]]
> I have a blog:
Alessandro Zivelonghi Ziller
Max-Planck-Institut für Plasmaphysik, Garching, DE
Middle-Age Fusion Engineer
" I'm sure that in 1985 plutonium is available in every corner drug
store, but in 1955 it's a little hard to come by"
More information about the Python-list