Dictionary limitation

pauljolly at my-deja.com pauljolly at my-deja.com
Fri Aug 4 09:11:40 EDT 2000


Thanks very much. Does exactly what I want!!

Best regards

Paul Jolly

In article <20000804140928.I266 at xs4all.nl>,
  Thomas Wouters <thomas at xs4all.net> wrote:
> 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!
>
>


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list