Select as dictionary...
Diez B. Roggisch
deets at nospam.web.de
Mon Oct 1 19:18:32 CEST 2007
> Also if i need a list id what can i do ?
> aia.execute("SELECT id, w from list")
> 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)
It will always return a list of tuples, so even if you'd do
select id from list
you'd end up with
But you shouldn't bother - a simple
idlist = [v for v in links]
should do it. Because this program shows that it takes only a split-second
to process 2 million list-entries and create a new one:
two_million = range(2000000)
start = time.time()
[i * 2 for i in two_million]
used = time.time() - start
Need 0.8 seconds on my machine. So - don't bother.
More information about the Python-list