In Python, for loops iterate over items in a list.  So range produces
a list of numbers.

Instead of using the index, what you might rather do would be to pass
the template a list of tuples:
   unique_counts = zip(uniques, rep_counts)

Then just iterate over that list and access the elements.


Robert





On Tue, Nov 2, 2010 at 09:50, Zeynel <[email protected]> wrote:
> On Nov 1, 5:06 pm, Robert Kluin <[email protected]> wrote:
>
>> In your template you need to print one or more of the entity's
>> _properties_, not the entity itself:   entity.property
>
> Thanks. I was confused about how the for loop works. I thought that in
> the following "rep" was the index. In fact it is an element in query.
> Correct?
>
> <table>
>  % for rep in query:
>    <tr>
>      <td>${rep.replist}</td>
>    </tr>
>  % endfor
> </table>
>
> But in the following "i" is an index:
>
> <table>
>  % for i in range(len(uniques)):
>    <tr>
>      <td>${uniques[i]} (${rep_counts[i]})</td>
>    </tr>
>  % endfor
> </table>
>
> Thanks again.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Google App Engine" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/google-appengine?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to