[Tutor] how do I create a lists of values associated with a key?

Lie Ryan lie.1296 at gmail.com
Thu Aug 28 14:23:02 CEST 2008


Message: 8
Date: Thu, 31 Jul 2008 20:16:54 -0700 (PDT)
From: Angela Yang <angelayian at yahoo.com>
Subject: [Tutor] how do I create a lists of values associated with a
       key?
To: tutor at python.org
Message-ID: <279879.31091.qm at web50107.mail.re2.yahoo.com>
Content-Type: text/plain; charset="iso-8859-1"


> That did not work because list index is not numeric.

Dictionary is an unordered set (list is an ordered set) indexed by a
immutable value (e.g. string, numbers, tuple)

> But for dictionaries, it is key - value pairs.? But I need key -> multiple
values.

That would mean, a dictionary of lists. Dictionary keys cannot be a mutable
(i.e. list cannot be a dictionary key) but dictionary's value may be
mutable.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20080828/8afa6af7/attachment.htm>


More information about the Tutor mailing list