On Mon, Oct 01, 2007 at 06:32:07AM -0700, Besturk.Net Admin wrote regarding Select as dictionary...: > > 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 ? > Try this:
aia.execute("SELECT id, w from list") links=aia.fetchall() linkdict = dict() for k,v in links: linkdict[k] = v print linkdict Cheers, Cliff -- http://mail.python.org/mailman/listinfo/python-list