Skip to content

Commit f1e56ca

Browse files
fix : minor edit
1 parent b54820f commit f1e56ca

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

csv2vcf/VCF.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def time_convert(input_data):
3333
def VCF_creator(first_name,last_name,tel_mobile,tel_home,tel_work,email_home,email_work,email_mobile):
3434
if "VCF_CONVERT" not in os.listdir():
3535
os.mkdir("VCF_CONVERT")
36-
file=open(os.path.join("VCF_CONVERT",last_name+"_"+first_name+".vcf"),"a")
36+
file=open(os.path.join("VCF_CONVERT",last_name+"_"+first_name+".vcf"),"w")
3737
file.write("BEGIN:VCARD\n")
3838
file.write("VERSION:3.0\n")
3939
file.write("N:"+last_name+";"+first_name+";;;"+"\n")
@@ -50,6 +50,7 @@ def csv_reader(file_name):
5050
try:
5151
file=open(file_name,"r")
5252
unknown_index=0
53+
vcf_counter=0
5354
for index,line in enumerate(file):
5455
if index>0:
5556
stripped_line=line.strip()
@@ -63,6 +64,9 @@ def csv_reader(file_name):
6364
VCF_creator("Unknown ",str(unknown_index),temp[2],temp[3],temp[4],temp[5],temp[6],temp[7])
6465
else:
6566
VCF_creator(temp[0],temp[1],temp[2],temp[3],temp[4],temp[5],temp[6],temp[7])
67+
vcf_counter+=1
68+
return vcf_counter
69+
6670
except Exception as e:
6771
print("[Error] In Reading CSV File")
6872

csv2vcf/__main__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
if __name__=="__main__":
55
if "contact.csv" in os.listdir():
66
time_1=time.perf_counter()
7-
csv_reader("contact.csv")
7+
counter=csv_reader("contact.csv")
88
time_2=time.perf_counter()
99
delta_time=time_2-time_1
10-
print("VCF Data Generated In " + time_convert(delta_time))
10+
print(str(counter)+" VCF File Generated In " + time_convert(delta_time))
1111
else:
1212
print("[Error] There is no csv input file")

0 commit comments

Comments
 (0)