Skip to content

Instantly share code, notes, and snippets.

@c0ldlimit
Created February 25, 2013 05:47
Show Gist options
  • Select an option

  • Save c0ldlimit/5028010 to your computer and use it in GitHub Desktop.

Select an option

Save c0ldlimit/5028010 to your computer and use it in GitHub Desktop.
#sqlite3 #python Dictionary cursor
# http://zetcode.com/db/sqlitepythontutorial/
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sqlite3 as lite
import sys
con = lite.connect('test.db')
with con:
con.row_factory = lite.Row
cur = con.cursor()
cur.execute("SELECT * FROM Cars")
rows = cur.fetchall()
for row in rows:
print "%s %s %s" % (row["Id"], row["Name"], row["Price"])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment