In Django templates you can do either

{% for item in xx.items %}
  Key: {{item.0}}, Value: {{item.1}}<br/>
{% endfor %}

or if you don't care about the keys

{% for value in xx.values %}
  {{value}}
{% endfor %}


Andi





On Wed, Aug 5, 2009 at 6:27 AM, yuan ping wu<oscar821...@gmail.com> wrote:
> in python.py:
> values={'mydictionary':{'a':'1','b':'2'}}
>
>
> {% for key  in mydictionry.items %}
>   {{key}}
> {%endfor%}
>
> reuslt will be  (a,1) (b,2)
>
> if change to
> {% for key  in mydictionry %}
>   {{key}}
> {%endfor%}
>
> it diplays: a b
>
> i still cunt get the value of key, tell me any modification of those code
> that maks it works ?
>
> 2009/8/4 yuan ping wu <oscar821...@gmail.com>
>>
>> it gets no thing. noth display on web
>>
>> 2009/8/4 Nick Johnson (Google) <nick.john...@google.com>
>>>
>>> Hi oscarWu,
>>>
>>> What error do you get, or if you don't get an error, what gets
>>> displayed? And what is the exact template snippet you're using for
>>> this? We need more details in order to help.
>>>
>>> -Nick Johnson
>>>
>>> On Mon, Aug 3, 2009 at 4:04 AM, oscarWu<oscar821...@gmail.com> wrote:
>>> >
>>> > I wanna put my dicitonary object on template
>>> > sth more like
>>> >
>>> > <body>
>>> >
>>> > {%for value,key in dictionary.items%}
>>> >     display key:display value
>>> > {%endfor%}
>>> > </body>
>>> >
>>> >
>>> > but my1 doesnt word, any1 can provide me specific code ?
>>> >
>>> > >
>>> >
>>>
>>>
>>>
>>> --
>>> Nick Johnson, Developer Programs Engineer, App Engine
>>>
>>>
>>
>
>
> >
>

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

Reply via email to