Skip to content

Instantly share code, notes, and snippets.

@ninux
Created February 2, 2013 23:23
Show Gist options
  • Save ninux/4699711 to your computer and use it in GitHub Desktop.
Save ninux/4699711 to your computer and use it in GitHub Desktop.
read from sqlite to file
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sqlite3 as lite
import sys
con = lite.connect('datenbank2')
id_ctr = 10
with con:
cur = con.cursor()
cur.execute('SELECT vorname, nachname FROM member WHERE id=10')
rows = cur.fetchall()
for row in rows:
print row
string = str(row)
f = open('results', 'r+')
f.write(string)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment