Last active
December 25, 2015 05:59
-
-
Save monsieuroeuf/6928340 to your computer and use it in GitHub Desktop.
Parse vcard file[s] generated by Contacts.app on OS X, and spit out some csv values suitable for use with Campaign Monitor etc.
This file contains hidden or 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 | |
import vobject | |
import sys | |
for fname in sys.argv[1:]: | |
f = open(fname) | |
v = vobject.readComponents(f) | |
while True: | |
try: | |
for i in v: | |
print u"{}, {}".format(i.fn.value, i.email.value).encode('utf-8') | |
break | |
except Exception, e: | |
print u"got an error: {}".format(i.fn.value) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Requires vobject.