Multidimensional Dictionaries: Possible?
François Pinard
pinard at iro.umontreal.ca
Mon Jan 24 20:46:22 EST 2000
w6uv at hotmail.com (Jerry Gardner) writes:
> Are multidimensional dictionaries possible in Python? I'm sure they're
> possible, but I can't figure out the syntax.
> Here's how I do it in Perl:
> %dict = (); # create empty dictionary
> $dict{$key1}{$key2} = $string; # make an entry
> $newstring = ${dict{$key1}{$key2}}; # access an entry
dict = {}
dict[key1, key2] = string
newstring = dict[key1, key2]
--
François Pinard http://www.iro.umontreal.ca/~pinard
More information about the Python-list
mailing list