Skip to content

Instantly share code, notes, and snippets.

@janseeger
Created April 30, 2017 12:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save janseeger/4a32142856c2a28099d6ca8dda33c174 to your computer and use it in GitHub Desktop.
Save janseeger/4a32142856c2a28099d6ca8dda33c174 to your computer and use it in GitHub Desktop.
Small script that extracts all contacts from a Baikal (http://sabre.io/baikal/) database and writes them into a single vcf file.
#!/usr/bin/python
import sqlite3
conn = sqlite3.connect("db.sqlite")
c = conn.cursor()
f = open("combined.vcf", "wb")
for row in c.execute("SELECT carddata FROM cards"):
data = row[0].encode("UTF-8")
f.write(data + "\n\n")
f.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment