[Tutor] Adding items from a cursor to a dict?

Khalid Al-Ghamdi emailkgnow at gmail.com
Mon Nov 12 09:29:23 CET 2012


Hi all,
How would you go about adding items from a cursor to a dictionary?

i tried this but to no avail:

>>> cur.execute('select * from schedule limit 10')
<sqlite3.Cursor object at 0x0112CE60>
>>> for i in range(len(cur.fetchall())):
d[i]=cur.fetchall()[i]

Traceback (most recent call last):
  File "<pyshell#70>", line 2, in <module>
    d[i]=cur.fetchall()[i]
IndexError: list index out of range

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20121112/6f0a6d11/attachment.html>


More information about the Tutor mailing list