Dictionary bidirectional

Kless jonas.esp at googlemail.com
Mon Jul 14 10:01:25 CEST 2008


But in my dictionary both keys and values are unique.

On Jul 14, 7:34 am, Dennis Lee Bieber <wlfr... at ix.netcom.com> wrote:
> On Sun, 13 Jul 2008 16:21:11 -0700 (PDT), Kless
> <jonas.... at googlemail.com> declaimed the following in comp.lang.python:
>
> > I need a dictionary where get the result from a 'key' (on left), but
> > also from a 'value' (on right), how to get it?
>
> > I know that dictionaries aren't bidirectional, but is there any way
> > without use two dictionaries?
>
>         Just out of curiosity... What do you expect to have returned from...
>
> aDict = { "one" : "two",
>                 "three" : "four",
>                 "What?" : "two"     }
>
> when looking for the value "two"?
>
>         In a dictionary, the /keys/ are unique... but the /values/ can be
> duplicates.



More information about the Python-list mailing list