Hi Fredrik. Many thanks for your reply and for the tuple tip. The 
cursor.fetchall returns a list of lists in this instance with each list 
in the main list containing the field values. With the tip, I 
simplified my code to:

vlist_dict = {}
record_count = 0
for record in cursor.fetchall():
        record_count += 1
        vlist_dict[record_count] = tuple(record)
print vlist_dict

That's much better!

Regards
David

On Monday, November 14, 2005, at 07:58 AM, Fredrik Lundh wrote:

>
> but doesn't fetchall already returns tuples, btw?  isn't something
> like
>
>     d = {}
>     for index, record in cursor.fetchall():
>         d[index+1] = record
>
> an easier way to get the dictionary you want?
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to