dictionaries - returning a key from a value

Michael Malinowski michael at guerrilla-games.com
Fri Sep 1 07:37:05 EDT 2006


Appologies if this is a somewhat simple question, but currently I can return
a value from a dictionary using its key by doing :

 

 dDictionary.get( key )

 

However, I am curious to know if its possible to get the key from giving a
value (basically the opposite of what I did above, instead of getting a
value from a key, I want the key from a value). Is there a way of doing
this? Or would I need to cycle all the keys until I hit a value match (which
seems somewhat cumbersome). 

 

Cheers

Mike. 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20060901/29fb45a7/attachment.html>


More information about the Python-list mailing list