Skip to content

Instantly share code, notes, and snippets.

@ashinzekene
Created August 26, 2018 13:44
Show Gist options
  • Save ashinzekene/988f3093dc2495299c4554ffc3c84a33 to your computer and use it in GitHub Desktop.
Save ashinzekene/988f3093dc2495299c4554ffc3c84a33 to your computer and use it in GitHub Desktop.
import csv
VCF_TEXT = ''
with open('./Final Year Bioscope Form.csv', mode='r') as csv_file:
csv_reader = csv.DictReader(csv_file)
lines_read = 0
for row in csv_reader:
if lines_read > 0:
VCF_TEXT += ("BEGIN:VCARD\n"
"VERSION:3.0\n" +
"N:{}\n".format(row['Name'].replace(',', '')) +
"FN:{}\n".format(row['Name'].replace(',', '')) +
"NICKNAME:{}\n".format(row['Nickname']) +
"NOTE:{}\n".format(row['Philosophy of Life']) +
"X-TWITTER:{}\n".format(row['Twitter Handle']) +
"TEL;WORK;VOICE:{}\n".format(row['Phone Number']) +
"BDAY:{}\n".format(row['Date of Birth']) +
"CATEGORIES:University of Lagos,CellBiology and Genetics,Helicase 18\n" +
"END:VCARD\n")
lines_read += 1
with open('Final Year Bioscope Form.vcf', 'w+') as vcf_file:
vcf_file.write(VCF_TEXT)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment