dictionary sub-value lookup

Richard richard at millinfo.co.za
Thu Feb 8 05:00:14 EST 2001


Okie, <python newbie tries better explanation>:

The object comes from a program.  I have no control over it.
Example of M[0]:
({'Label': 251, 'value': 1275.0})

I just throught there was some easy way of getting M[i] given that
M[i]['Label'] = 251 ... when what I really want is M[i]['value']

ie: given '251', find corrosponding 1275.

Bearing in mind, M is actually HUGE, and M[i] contains about 10
lines of uninteresting data when printed.  There is a LOT of
information here, and I would like the thing to be fast.  I just
thought that maybe there was some funky python or OO way of doing
it (since I am from a Fortran background).


More information about the Python-list mailing list