yea lets look at that...

for i in hola...

that sets i to 'h' then 'o' then 'l' and finally 'a' and prints each letter 
to the console.
then 'return locals()'
i will be 'a' because that's what it was set to last.

get it?

so if you want hola or aloha...
controller:
i = 'aloha'
return i
view:
{{=i}}
or as Mass suggested, 


On Tuesday, May 12, 2015 at 2:46:45 PM UTC-7, KevC wrote:
>
> Hi!
>
> I got a problem, I wanna print a list or string on a 'view' using  a 'for' 
> but the view only show me the last number or letter. For example:
>
> My controller...
>
> for i in 'hola':
>      print i
>      return locals()
>
>
> My view...
>
> {{=i}}
>
> The view only show me the letter 'a'.
> Other example:
>
> a = [1,2,3]
> for i in a:
>      print i
>      return locals()
>
> My view...
>
> {{=i}}
>
> The view only show me the number 3.
>
> I got a mistake? Somebody help me.
> I used the console and It's ok, print all list and string.
>
> My best regards.
>
>
>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to