![]() ![]() type in credit_transactions:Ĭredit = transaction. #!/usr/bin/env python3 # -*- coding: utf-8 -*- from csv import DictWriter from glob import glob from ofxparse import OfxParser DATE_FORMAT = "%m/%d/%Y" def write_csv( statement, out_file):Ĭredit = "" debit = "" balance = balance + transaction. ![]() Out_file = "converted_" + qfx_file.replace(".qfx",".csv") Qfx = OfxParser.parse(open(qfx_file, encoding="latin-1")) Raise ValueError("Unknown transaction type:" + transaction.type) If transaction.type in credit_transactions:Įlif transaction.type in debit_transactions: Writer = DictWriter(f, fieldnames=fields)Ĭredit_transactions = ĭebit_transactions = įor transaction in : Hopefully these updates will be useful to other folks too. changed "raise Error" to "raise ValueError" and print the unknown transaction typeĪppreciate the work folks.Forced utf8 on open() (banks especially like to add cp 1252 junk).Updated to use python3-style open() instead of file().added lists to enumerate multiple types of credit and debit transactions. ![]() I've updated it for python3, with minor optimizations: Awesomely useful utility script, much appreciated. balance statement = Ĭredit = "" debit = "" balance = balance + transaction. Print "Writing: " + out_file fields = īalance = qfx. replace( ".qfx", ".csv")įrom csv import DictWriter from glob import glob from ofxparse import OfxParser DATE_FORMAT = "%m/%d/%Y" def write_csv( statement, out_file): Writer = DictWriter( f, fieldnames = fields)īalance = qfx. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |