Newbie question: Dictionary of lists
Kossmann, Bill
BKossmann at dthr.ab.ca
Wed Feb 16 18:22:09 EST 2000
More information about the Python-list mailing list
Wed Feb 16 18:22:09 EST 2000
- Previous message (by thread): Barcode-module
- Next message (by thread): Newbie question: Dictionary of lists
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Carel, I'll have "guaranteed-unique" account codes because we don't have synonyms in our Chart of Accounts, and the individual account segments must be in the same domain/format. Good point about using a tuple as the key--as you say, it adds a bit of insurance to the script. Thanks for the tip, and thanks again to Remco for the slap-to-the-side-of-the-head reminder about references. Bill -----Original Message----- From: Carel Fellinger [mailto:cfelling at iae.nl] Sent: Wednesday, February 16, 2000 14:51 To: python-list at python.org Subject: Re: Newbie question: Dictionary of lists 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 -- http://www.python.org/mailman/listinfo/python-list
- Previous message (by thread): Barcode-module
- Next message (by thread): Newbie question: Dictionary of lists
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list