-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcmpCSV.py
34 lines (30 loc) · 1.03 KB
/
cmpCSV.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import io
import os
from os.path import isfile, join
import re
# import pandas as pd
class Recruiter:
def __init__(self,line=""):
spl=line.split(',')
self.firstname=spl[0]
self.lastname=spl[1]
self.emailid=spl[2]
self.org=spl[3]
self.position=spl[4]
class Contacts:
def __init__(self):
self.cstack=[]
def readfiles(self):
dirPath = '.\\'
fileNameList = [filename for filename in os.listdir(dirPath) if isfile(join(dirPath,filename)) and ".csv" in filename ]
# print(fileNameList)
for filename in fileNameList:
with io.open(filename, 'rU', encoding='utf-8') as clist:
next(clist)
for line in clist:
contact = re.findall(r'^(.*),"\d.*',line)[-1]
if not contact in self.cstack:
rec=Recruiter(contact)
self.cstack.append(rec)
# print(contact)
return self.cstack