Skip to content

Instantly share code, notes, and snippets.

@siroken3
Created August 22, 2012 05:20
Show Gist options
  • Save siroken3/3422452 to your computer and use it in GitHub Desktop.
Save siroken3/3422452 to your computer and use it in GitHub Desktop.
pythonから sqlite3を使うサンプル (カラム名使う編)
#!/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