Re: assigning variables from list data

2010-08-18 Thread Aahz
In article mailman.1627.1281018398.1673.python-l...@python.org, Chris Hare ch...@labr.net wrote: cursor.execute('select * from net where NetNumber 0') Unless your table is guaranteed to never change layout, I suggest that instead listing fields is a Good Idea: cursor.execute('select

Re: assigning variables from list data

2010-08-06 Thread Bruno Desthuilliers
Chris Hare a écrit : I have a database query result (see code below). In PHP, I would have said list(var1,var2,var) = $result Other already answered on the Python equivalent. But there's an IMHO better way, which is to use (if the DB-API connector provides it) a DictCursor, that yields

assigning variables from list data

2010-08-05 Thread Chris Hare
I have a database query result (see code below). In PHP, I would have said list(var1,var2,var) = $result and each element in the list would be assigned to each of the named variables. I have my data coming out of the database, and I can see it is a list. so my question is, instead of

Re: assigning variables from list data

2010-08-05 Thread Benjamin Kaplan
On Thu, Aug 5, 2010 at 7:26 AM, Chris Hare ch...@labr.net wrote: I have a database query result (see code below).  In PHP, I would have said list(var1,var2,var) = $result and each element in the list would be assigned to each of the named variables.  I have my data coming out of the

Re: assigning variables from list data

2010-08-05 Thread Tim Chase
On 08/05/10 09:26, Chris Hare wrote: I have a database query result (see code below). In PHP, I would have said list(var1,var2,var) = $result and each element in the list would be assigned to each of the named variables. I have my data coming out of the database, and I can see it is a list. so