assigning variables from list data

Aahz aahz at pythoncraft.com
Wed Aug 18 21:38:08 CEST 2010


In article <mailman.1627.1281018398.1673.python-list at python.org>,
Chris Hare  <chare at 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 netNumber, netType, .... from net where NetNumber > 0')

Then the tuple unpack suggested by other posters will never fail.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"...if I were on life-support, I'd rather have it run by a Gameboy than a
Windows box."  --Cliff Wells



More information about the Python-list mailing list