I should have known that IterBetter comes with batteries included. Very nice.

Ole.

 
Am 25.07.2013 um 17:40 schrieb Kevin Houlihan:

> You can reference the rows by index, so if you know there can be only one 
> result you can just retrieve the first row:
> 
> data = user_data[0]
> print data.name
> 
> If there's a possibility that there could be no results, you'll want to catch 
> IndexError exceptions.
> 
> --
> Kevin
> 
> 
> 
> On Thu, Jul 25, 2013 at 3:56 PM, Claudio Dusan Vega Ozuljevich 
> <[email protected]> wrote:
> Hi guys.
> 
> I got this statement
> 
> user_data = web.ctx.db.select('role',
>                                     what="id, name, email,
> administrative_division",
>                                     where="email=$user_input_email",
>                                     vars={"user_input_email":user_input.email}
>                                     )
> 
> now my question is, if I want to access just the name, how do I do it?
> 
> I'm using the following statement, but I think is a wrong way to do it.
> 
> for data in user_data:
>     print data.name
> 
> is there a way to access the parameter name or any other without using
> the for in.
> 
> Thanks in advance!


-- 
Ole Trenner
<[email protected]>




-- 
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/webpy.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to