dictionaries with nested lists

Francis Avila francisgavila at yahoo.com
Sun Nov 2 10:27:10 CET 2003


"ruari mactaggart" <ruari at charliefortune.com> wrote in message
news:bo1ccs$juu$1 at news7.svr.pol.co.uk...
> what if i mean
>
bands={'beatles':['john','paul','george','ringo'],['guitar','bass','guitar',
> 'drums']}
>
> then i need to put bands['beatles'][1][3]='percussion'
>
> i presume... ?

If things are getting this complicated, you're probably better off a)
wrapping an interface to this dict using an object, or b) just using object
attributes and using those objects as dictionary items.

Oh, and you need to group those two lists into a single list or tuple....
--
Francis Avila





More information about the Python-list mailing list