Skip to content

Instantly share code, notes, and snippets.

@kolen
Created February 13, 2009 20:00
Show Gist options
  • Save kolen/64070 to your computer and use it in GitHub Desktop.
Save kolen/64070 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
import sqlite3
conn = sqlite3.connect('/tmp/example')
c = conn.cursor()
# Create table
c.execute('''create table stocks
(date text, trans text, symbol text,
qty real, price real)''')
for i in xrange(1, 1000):
c.execute("""insert into stocks
values ('2006-01-05','BUY','RHAT',100,35.14)""")
conn.commit()
# We can also close the cursor if we are done with it
c.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment