Wednesday, January 20, 2010

Re: TypeError: 'float' object is not iterable

2010/1/20 Christopher Bird <birdchristopher0@gmail.com>:
> Hi
>
> Im trying iterating over a dictionary.
> i have no problem with this but when i get to the last key:value
> ( value is a list) i get the following error
>
>
> value= list
> TypeError: 'float' object is not iterable
>
>
>
> django code
>
>
> {% for states in prices_demand.items %}
>
> <h1>
> {{ states.0 }}
> </h1>
> {{ states.1.items.2.0 }}={{ states.1.items.2.1 }}<br>
>
> {{ states.1.items.0.0 }}={{ states.1.items.0.1 }}<br>
>
> {{ states.1.items.3.0 }}={{ states.1.items.3.1 }}<br>
>
> {{ states.1.items.5.0 }}={{ states.1.items.5.1 }}<br>
>
> {{ states.1.items.7.0 }}={{ states.1.items.7.1 }}<br><br>
>
>
>
> {{ states.1.items.6.0 }}<br>
>
>
> <! This is were django messes up>
>
> {% for x in states.1.items.6.1 %}
>
> {{ x }}
>
> {% endfor %}
> {% endfor %}
>
>
> Am i asking django to do too much??

Looks to me like prices_demand.items is a dictionary, but whatever is
in states.1.items.6.1 is *not* a dictionary - it's a float, and
there's no sensible way to do a for loop over a float.

--
Cheers,
Simon B.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate