Select as dictionary...
Carsten Haese
carsten at uniqsys.com
Mon Oct 1 13:21:43 EDT 2007
On Mon, 2007-10-01 at 10:13 -0700, Abandoned wrote:
> Also if i need a list id what can i do ?
>
> aia.execute("SELECT id, w from list")
> links=aia.fetchall()
>
> I want to..
>
> idlist=[1, 2, 3] ( I don't want to use FOR and APPEND because the
> query have 2 million result and i want to speed)
The canonical replacement for a for/append loop is a list comprehension:
idlist = [x[0] for x in links]
HTH,
--
Carsten Haese
http://informixdb.sourceforge.net
More information about the Python-list
mailing list