Dictionary limitation

entropia entropiamax at jazzfree.com
Fri Aug 4 08:33:25 EDT 2000


You can use:
fruitDictionary={'apple':applePriceList=[], 'banana':bananaPriceList=[]....}

Thomas Wouters escribió:

> On Fri, Aug 04, 2000 at 11:51:00AM +0000, pauljolly at my-deja.com wrote:
>
> > I have a query regarding dictionaries. Say I want to define a
> > dictionary to do with fruits as follows:
>
> > fruitDictionary={'apple':applePriceList, 'banana':bananaPriceList....}
>
> > where the value refers to the name of a list of the prices of apples
> > that I will add to as I find prices. Is there any way when I define the
> > dictionary, that I can initialise the lists to zero length (ie temp=[])
> > at the same time?
>
> How about this:
>
> fruitDictionary = {
>         'apple': [],
>         'banana': [],
>         'spam': [],
>         ...
>         }
>
> Does that do what you want ?
>
> --
> Thomas Wouters <thomas at xs4all.net>
>
> Hi! I'm a .signature virus! copy me into your .signature file to help me spread!
>
> --
> http://www.python.org/mailman/listinfo/python-list





More information about the Python-list mailing list