Thanks for the info Anthony.
Denes, you just added a trick to my python arsenal. TY.
Noel
arr = [ form.vars['x%s'%x] for x in range(3) ]
On Sep 6, 11:48 pm, Noel Villamor wrote:
> Code:
> if form.accepts(request.vars, session):
> arr = ['a','b','c']
> for i in range(3):
> arr[i] = form.vars.x
>
> Desired:
> In the for loop, I wanted to have
> arr[0] = form
form.vars (as well as request.vars) is an instance of the Storage class,
which inherits from dict
(see http://web2py.com/book/default/chapter/04#request for some details
about Storage objects). So, you can use regular Python dict methods on
form.vars. For example, to get a list of the values of
3 matches
Mail list logo