[pygtk] Treeview and sqlite

Thomas Dybdahl Ahle lobais at gmail.com
Sun Nov 18 19:30:43 WST 2007


lør, 17 11 2007 kl. 14:27 +0100, skrev Marcel Stoop:
> Hey all,
> 
> First of all I new to python and reading a lot of documentation, but
> somehow I can't seem to find good information regarding the question
> below.
> I'm trying to develop a python/pygtk application which need to store the
> data from the treeview in a sqlite db.
> Anybody here who is familiar with this and can give some pointers in the
> right direction?

This should work:
con = sqlite.connect(path)
cur = con.cursor()
for row in liststore:
    cur.execute("INSERT INTO databasename (col1,col2) "+
                "VALUES ('%s','%s')" % tuple(row))

-- 
Med venlig hilsen,
Best regards,
Thomas



More information about the pygtk mailing list