ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/ns_dev/Python/NinoCode/Active_prgs/Ledger/LedgerTranFixes.py
Revision: 644
Committed: Wed Mar 28 20:27:35 2018 UTC (8 years ago) by nino.borges
Content type: text/x-python
File size: 1055 byte(s)
Log Message:
Initial working Version.

File Contents

# Content
1 """
2 LedgerTranFixes
3
4 Created by
5 Emanuel Borges
6 12.20.2017
7
8 This program will take the transactions that just have a minus and amount and change to positive with
9 a dollar sign.
10
11 """
12
13 import re
14
15
16 if __name__ == '__main__':
17 workFile = "/home/nino/ledger/pvisaCorrection4.txt"
18 outputFile = open("/home/nino/ledger/pvisaCorrectionOutput4.txt",'w')
19 contents = open(workFile).readlines()
20 for line in contents:
21 if line[:13] == " Expenses:":
22 newline = line.split(" ")
23 oldAmount = newline[-1]
24 if "-" in oldAmount:
25 newAmount = oldAmount.replace("-","$")
26 else:
27 newAmount = "$-" + oldAmount
28 if "." in newAmount:
29 pass
30 else:
31 newAmount = newAmount.replace("\n",".00\n")
32 test = newAmount.split(".")[-1]
33 if len(test) <3:
34 newAmount = newAmount.replace("\n","0\n")
35 line = line.replace(oldAmount,newAmount)
36 outputFile.write(line)
37 outputFile.close()