Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import csv
- import vobject
- # Open CSV shittie
- with open('contacts.csv', 'r') as csvfile:
- reader = csv.reader(csvfile)
- # Skip theheader row
- next(reader)
- # Iterate through the rows
- for row in reader:
- # Create a new fucking vcf
- vcard = vobject.vCard()
- # Add name
- vcard.add('fn')
- vcard.fn.value = row[0]
- # Add phone number
- vcard.add('tel')
- vcard.tel.value = row[1]
- vcard.tel.type_param = 'CELL'
- # Write the vcf to a file
- with open(row[0] + '.vcf', 'w') as vcffile:
- vcffile.write(vcard.serialize())
Add Comment
Please, Sign In to add comment