def __init__(self, filepath): self.data = [] with open(absolutepath(filepath)) as text_data: csv_data = csv.DictReader(text_data, delimiter=',') for row in csv_data: self.data.append(row) pass
def __init__(self, filepath): self.data = [] # opening the CSV file as text data with open(absolutepath(filepath)) as text_data: # reading the CSV file as dictionary data strucuture csv_data = csv.DictReader(text_data, delimiter=',') # displaying the contents of the CSV file for row in csv_data: self.data.append(row) pass