Nested dictionaries trouble

7stud bbxx789_05ss at yahoo.com
Thu Apr 12 03:28:08 CEST 2007


On Apr 11, 7:01 pm, "7stud" <bbxx789_0... at yahoo.com> wrote:
> On Apr 11, 2:57 pm, Bruno Desthuilliers
>
> <bdesth.quelquech... at free.quelquepart.fr> wrote:
> > IamIan a écrit :
>
> > yearTotals = dict([(year, dict.fromkeys(months, 0)) for year in years])
>
> > HTH
>
> List comprehensions without a list?  What? Where? How?

Ooops.  I copied the wrong one.  I was looking at this one:

yearTotals = dict((year, monthTotals) for year in years)



More information about the Python-list mailing list