If you run a sql statement, and want to iterate over the cursor to assign keys and values to a dictionary, do the following:
- >>> my_dict={}
- >>> for key, value in cur.execute('select badge, name from sched'):
- my_dict[key]=value
No comments:
Post a Comment