module for working with the result set
Diez B. Roggisch
deetsNOSPAM at web.de
Tue May 18 05:22:46 EDT 2004
> OK thats great! I did the following and it works.
> for field in range(0,len(mydata[0])):
> print mydata[0][field]
> following your thoughts on the keys and my mistake - can you tell me how
> to get into a dict format?
Its a one-liner: If fnames is the list of column names (remember you can get
these from the cursor) and row is your data, this will create a dict out of
them:
d = dict(zip(fnames, row))
Thats all.
--
Regards,
Diez B. Roggisch
More information about the Python-list
mailing list