/ Published in: Python
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
import sqlite3 c = sqlite3.connect('medialib.db') sql="SELECT name FROM sqlite_master WHERE type='table';" r=c.execute(sql) for row in r.fetchall(): print row cur = c.cursor() cur.execute('CREATE TABLE foo (o_id INTEGER PRIMARY KEY, fruit VARCHAR(20), veges VARCHAR(30))') con.commit() cur.execute('INSERT INTO foo (o_id, fruit, veges) VALUES(NULL, "apple", "broccoli")') con.commit() print cur.lastrowid