[Tutor] Return key from value
orbitz at ezabel.com
orbitz at ezabel.com
Thu May 13 15:37:44 EDT 2004
key -> value have a one to one relationship.
value -> key have a 1 to many relatinoship.
You will most likley need to iterate over your dictionary and check if the value
matches, and construct a list of keys.
If you have such a large datastructure, I wonder why you are doing this in the
first place?
On Thu, 13 May 2004 12:13:59 -0700
"firephreek" <firephreek at earthlink.net> wrote:
> I thought there was a method for it, but I can't seem to find it.
>
> Does anyone know how I can return the matching key from a dictionary if
> I know the value? I'm working with some very large data structures, and
> I don't want to have to duplicate them.
>
> Stryder
>
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
More information about the Tutor
mailing list