def __init__(self, fp, **kwargs): BaseFormat.__init__(self, fp, **kwargs) if PY2: reader = csv.reader(fp, delimiter=self.delimiter, encoding=DEFAULT_ENCODING) else: reader = csv.reader(fp, delimiter=self.delimiter) self.data = [row for row in reader]
def __init__(self, fname): super(DelimitedFormat, self).__init__(fname) with open(fname, 'r') as fp: if PY2: reader = csv.reader(fp, delimiter=self.delimiter, encoding=DEFAULT_ENCODING) else: reader = csv.reader(fp, delimiter=self.delimiter) self.data = [row for row in reader]