-
Notifications
You must be signed in to change notification settings - Fork 0
/
CSVFile.py
27 lines (23 loc) · 886 Bytes
/
CSVFile.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
import csv
import string
class CSVFile(object):
"""docstring for CSVFile"""
def __init__(self, fileanme="dataset/ConceptTeam1.csv"):
super(CSVFile, self).__init__()
self.fileanme = fileanme
def getContent(self):
conceptlist = list()
with open(self.fileanme,'r') as csvfile:
firstline = True
reader = csv.reader(csvfile)
for row in reader:
if firstline:
firstline = False
continue
def trim_str(str, exclude): return ''.join(ch for ch in str if ch not in exclude)
ex = string.punctuation
conceptlist.append([trim_str(row[1],ex),trim_str(row[2],ex),trim_str(row[3],ex)])
return conceptlist
if __name__ == '__main__':
file = CSVFile("dataset/ConceptTeam1.csv")
print( file.getContent())