I\'m using sqlite3 in python 2.5. I\'ve created a table that looks like this:
create table votes ( bill text, senator_id text, vote text) <
I've used this:
def get_dict(sql): return dict(c.execute(sql,()).fetchall())
Then you can do this:
c = conn.cursor() d = get_dict("select user,city from vals where user like 'a%'");
Now d is a dictionary where the keys are user and the values are city. This also works for group by
d
user
city
group by