You can't, really. I mean, you can, but it involves deep Python magic
which is bad, bad, bad. The closest non-magical solution would be:
first_name, last_name, username = dbRow("select first_name, last_name,
username from users where user_id = 1")
To do this, you'd modify dbRow to return a list or tuple. This is what
I always do. It also removes the ambiguity of something like:
db1Row("select a.b, c.b, d.e from x")
Where the dictionary will contain "a.b", "c.b" and "e". I always hated
that.
On Sun, 2002-01-27 at 21:43, Rolf Hanson wrote:
> Hi,
> I'm trying to write a function which will automagically return multiple
> variables to a .PSP page. I'm a relative newbie to python so I'm not sure if
> there is an easy way to do this.
>
> Here's what I'm trying to do:
>
> I made a function called db1Row() that given a query returns a dictionary.
> Thus in my page I do:
>
> <%
> d = db1Row("select first_name, last_name, username from users where user_id
> = 1")
> %>
>
> First Name = <%=d['first_name']%>
> Last Name = <%=d['last_name']%>
>
> What I want to be able to do (if possible) is to modify my db1Row function
> so that in my .PSP page I can just do this:
>
> First Name = <%=first_name%>
> Last Name = <%=last_name%>
>
> How would I go about doing this?
>
> Thanks,
>
> Rolf
>
>
>
> _______________________________________________
> Webware-discuss mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/webware-discuss
>
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss