Besturk.Net Admin a écrit :
> Hi..
> I am using python with postgresql.
> And i have a query :
> 
> aia.execute("SELECT id, w from list")
> links=aia.fetchall()
> print links
> 
> and result
> [(1, 5), (2,5).......] (2 million result)
> 
> I want to see this result directly as a dictionary:
> 
> {1: 5, 2: 5 .....}
> 
> How do i select in this format ?

IIRC, postgres' db-api connector (well, at least one of them - I don't 
know which one you're using) has a DictCursor. You should find all you 
want to know in the relevant doc.

FWIW:
http://www.initd.org/tracker/psycopg/wiki/PsycopgTwoFaq

HTH
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to