Skip to content

Commit 8ae3078

Browse files
authored
Condense descriptions with lots of extra spaces
1 parent 0a30c6b commit 8ae3078

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/groupsplit.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
import re
23
import csv
34
import sys
45
import json
@@ -131,9 +132,9 @@ def main():
131132

132133
if has_title_row:
133134
rows = rows[1:]
134-
transactions = [{"date":datetime.strftime(datetime.strptime(r[date_col], "%m/%d/%y"), "%Y-%m-%dT%H:%M:%SZ"),
135-
"amount":-1 * Money(r[amount_col], local_currency),
136-
"desc":r[desc_col]}
135+
transactions = [{"date": datetime.strftime(datetime.strptime(r[date_col], "%m/%d/%y"), "%Y-%m-%dT%H:%M:%SZ"),
136+
"amount": -1 * Money(r[amount_col], local_currency),
137+
"desc": re.sub('\s+',' ', r[desc_col]})
137138
for r in rows if float(r[amount_col]) < 0]
138139
splits = []
139140
for t in transactions:

0 commit comments

Comments
 (0)