Created
August 22, 2012 05:20
-
-
Save siroken3/3422452 to your computer and use it in GitHub Desktop.
pythonから sqlite3を使うサンプル (カラム名使う編)
This file contains 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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import sqlite3 | |
if __name__ == "__main__": | |
con = sqlite3.connect("dbname.db") | |
con.row_factory = sqlite3.Row | |
for row in con.execute("select col1, col2 from table_name"): | |
print row['col1'], row['col2'] | |
con.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment