Created
February 25, 2013 05:47
-
-
Save c0ldlimit/5028010 to your computer and use it in GitHub Desktop.
#sqlite3 #python Dictionary cursor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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