Multiple values for one key

Terry Reedy tjreedy at udel.edu
Wed Aug 27 19:56:54 EDT 2008



Ron Brennan wrote:
> Hello,
>  
>  
> How would I create a dictionary that contains multiple values for one 
> key.

Make the value a collection object (set or list if you plan to add and 
delete).

>  I'd also like the key to be able to have duplicate entries.

Dict keys must be hashable and unique.

tjr




More information about the Python-list mailing list