Strongly Emergent

What comes from combining humans, computers, and narrative

Generating vCards in Python

At work recently, I had to test an address book application. Part of the requirement for testing was that it handle large numbers of contacts gracefully - 100, 1000, 5000, or 10,000. My personal address book is nowhere near that big (and I’m not about to use it for testing), so I turned to Python. [The vCard format][vcard-wiki] is pretty much a special kind of text file, so it’s easy to create new vCards, and a vCard can contain multiple contacts by just concatenating contacts.

I didn’t find exactly what I needed already in existence, so I wrote up a basic script to do it, and in case anyone else needs it, here it is. It is released under the Apache Software License 2.0, and I hope you find it useful.

Writing this was basically like doing sit-ups in Python—not really challenging, but demanded like all serious tasks that you sit down and devote time and concentration to it. After that, results come easily.