1 import os
2 import csv
3 from ExceptionHelper import FileNotExistError
7
8 _data = []
9 _path = None
10
12 """
13 Constructor for class
14
15 @param path : path to the excel file
16 """
17 if not os.access(path, os.F_OK):
18 raise FileNotExistError('Cannot find the csv file [%s]' % path)
19 self._path = path
20 self.csv2dict()
21
23 """
24 Convert csv data to lists, the result will be stored in data attribute
25 """
26 with open(self._path, 'rb') as f:
27 rows = csv.DictReader(f)
28 for row in rows:
29 self._data.append(row)
30
31 @property
33 """
34 The csv data extracted from the file
35 """
36 return self._data
37