Dictionary limitation

Thomas Wouters thomas at xs4all.net
Fri Aug 4 08:09:28 EDT 2000


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!




More information about the Python-list mailing list