Created
April 10, 2018 21:19
-
-
Save CRImier/ad8c27c19dea801c34bf26cd8820c433 to your computer and use it in GitHub Desktop.
Swedbank Latvia CSV parser script, creates a nice dictionary
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import csv | |
| f = open("statement.csv", "r", encoding="iso8859_13") | |
| #def reencode(file): | |
| # for line in file: | |
| # yield line.decode('iso8859_13').encode('utf-8') | |
| r = csv.reader(f, delimiter=";", quotechar='"') | |
| l = [line for line in r] | |
| names = ["account", "num1", "date", "sender", "desc", "amount", "currency", "k-d", "date_precise", "type", None, "document_num"] | |
| donations = [] | |
| for line in l: | |
| d = {} | |
| for i, name in enumerate(names): | |
| if name: | |
| d[name] = line[i] | |
| donations.append(d) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment