[Tutor] how do I create a lists of values associated with a key?
Angela Yang
angelayian at yahoo.com
Fri Aug 1 05:16:54 CEST 2008
Hi,
I have a list of values for one key. How do I specify this data structure?
First tried,
collection = []
collection['abby'].append('apprentice1')
collection['abby'].append('apprentice2')
That did not work because list index is not numeric.
But for dictionaries, it is key - value pairs. But I need key -> multiple values.
Do you have some example how to specify this?
Angela
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20080731/f499e527/attachment-0001.htm>
More information about the Tutor
mailing list