Building lists

Denis McMahon denismfmcmahon at gmail.com
Tue Oct 21 00:30:27 CEST 2014


On Mon, 20 Oct 2014 20:40:18 +0100, MRAB wrote:

> There are a number of stores, so that would be a list of stores. For
> each store you want the price of each item, so that would be a dict
> where the key is the item and the value is the price of that item. That
> means it would be a list of dicts.
> 
> Does that help?

It think it would be a dict of dicts:

shopping = { "store1" : { "item1": price1, "item2": price2, ...  }, 
"store2" : { "item3": price3, "item4": price4, ... }, ... }

-- 
Denis McMahon, denismfmcmahon at gmail.com



More information about the Python-list mailing list