ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/ns_dev/Python/NinoCode/Active_prgs/Ledger/LedgerTranFixes.py
Revision: 657
Committed: Thu Dec 12 21:07:35 2019 UTC (6 years, 3 months ago) by nino.borges
Content type: text/x-python
File size: 1103 byte(s)
Log Message:
Small changes

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/Nextcloud/Nino And May/Fin/Amanda To-Do/DoneLedger.txt"
18 outputFile = open("/home/nino/Nextcloud/Documents/Ledger/pvisaCorrectionOutput21.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()