Skip to content

Instantly share code, notes, and snippets.

@inabhi9
Created September 4, 2014 12:10
Show Gist options
  • Save inabhi9/b194d44fcaea2f642354 to your computer and use it in GitHub Desktop.
Save inabhi9/b194d44fcaea2f642354 to your computer and use it in GitHub Desktop.
Split single vCard to multiple vcards
#!/usr/bin/python
cnt = 0
o = None
with open('/tmp/00001.vcf') as f:
for l in f.readlines():
if 'BEGIN:VCARD' in l:
o = open('/tmp/contacts/%s.vcf' % cnt, 'w')
o.write(l)
if 'END:VCARD' in l:
o.close()
cnt += 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment