Newbie question: Dictionary of lists
Carel Fellinger
cfelling at iae.nl
Wed Feb 16 16:51:02 EST 2000
Hai Bill,
Remco already pointed out how to fix your code, so I wil only add some noice:)
Maybe you are not aware of the fact that in python dictionary keys could wel
be tuples? Quite likely that someday you will be bitten by non uniquely conca-
tenatable account codes like 00,1 and 0,01:)
Kossmann, Bill <BKossmann at dthr.ab.ca> wrote:
...
> period names, and amounts; the dictionary's key is a concatenation of the
> account codes, and the values are 12-element lists (one for each month). I
> want a sample dictionary entry to look like this:
> {'00006101071115000000': [10, 20, 30 ... 120]}
as bit-prevention you could change the key you use from
> # Key is our cost centre code
> dictionaryKey = histRcd[0]+histRcd[1]+histRcd[2]+histRcd[3]
to
dictionaryKey = (histRcd[0], histRcd[1], histRcd[2], histRcd[3])
--
groetjes, carel
More information about the Python-list
mailing list