def read_csv(csv_file): f = open(csv_file) reader = csv.reader(f, delimiter='\t') entries = [] for k in reader: entry = Entry() entry.date = datetime.strptime(k[2], "%Y%m%d").strftime('%Y/%m/%d') entry.amount = Decimal(k[6].replace(",", ".")) entry.description = k[7] entries.append(entry) return entries
def create_new_entry(self, amount, date): new_entry = Entry() new_entry.amount = Decimal(amount) new_entry.date = date return new_entry