[Tutor] Dictionary Keys

Gregor Lingl glingl@aon.at
Tue, 06 Aug 2002 22:16:23 +0200


Alan Colburn schrieb:

> I'm trying to figure something out and I KNOW this must be something 
> pretty common. ...
>  
> Basically, what do y'all tend to do when you are entering/saving 
> information in a dictionary and, the way you've set up your script's 
> parameters, you could conceivably create key:value combinations with 
> identical keys (but different values)? I could think of many examples 
> but, for the sake of concreteness, suppose a medical office is 
> recording patient visits (patient's name, visit date, other 
> information), using the patient's name as the key. The rest of the 
> information is the key's value, perhaps stored in a list. If each 
> visit represents a separate key:value combination, and a person makes 
> multiple visits to the office, then ...?
>  
> As always, thanks ahead of time! -- Al C.

Unconventionally I give you a reference to

http://www.oreilly.com/catalog/pythoncook/chapter/

There you find a link to the sample Chapter 1 of  the Python Cookbook.(PDF)
If all of the book is as well done as this first Chapter it is a 
must-buy I think!

Section 1.5 is: Associating Multiple Values with Each Key in a Dictionary

I certainly couldn't give you an explanation, which surpasses this one

Regards, Gregor