Dictionary with Lists
Mick Krippendorf
mad.mick at gmx.de
Sun Oct 4 05:27:25 EDT 2009
John Nagle schrieb:
> Shaun wrote:
>> I'm trying to create a dictionary with lists as the value for each
>> key.
>
> Try using a tuple, instead of a list, for each key. Tuples
> are immutable, so there's no issue about a key changing while
> being used in a dictionary.
Only if Shaun wanted to use lists as keys (which of course doesn't
work). Luckily he just wants them as values.
Mick.
More information about the Python-list
mailing list