On Tuesday, December 30, 2014 1:59:37 PM UTC-8, Alex Glaros wrote:
>
> but how to keep from overwriting the preceding variable contents within
> the loop process?
>
arglist=[]
for row in rows:
arglist.append(row.firstname)
# pass
or
vardict = {}
for row in rows:
# use an arbitrary key unless we have a better choice
vardict[row.id = row.firstname]
# pass
(I'm using row.id as a key just as an example; recall that dictionaries
create an entry when you assign to a key that isn't already in the
dictionary)
Unless I'm missing something. Oh, I wrote the code as for a controller
function, but if you need it in a view just brace yourself to do the proper
wrapping.
/dps
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.