On Mar 17, 11:44 am, John Gordon <gor...@panix.com> wrote: > In <2f4a08df-55ea-4a4e-9cc0-24e6b9f81...@f15g2000pro.googlegroups.com> > Wanderer <wande...@dialup4less.com> writes: > > > But when the program returns the value I can't get the key. > > What happens when two keys have the same value? How would you know which > key to return? > > In your sample code all the values are different, but surely that won't > always be the case with real data. > > -- > John Gordon A is for Amy, who fell down the stairs > gor...@panix.com B is for Basil, assaulted by bears > -- Edward Gorey, "The Gashlycrumb Tinies"
I guess two keys having the same value is why dictionaries don't return keys for values, but this is a code. Each value has a unique meaning to both sender and receiver. The text part is for making the program understandable and printing understandable error messages. -- http://mail.python.org/mailman/listinfo/python-list