add argument to home converter
This commit is contained in:
parent
f114faf2d2
commit
094dfd9b4c
21
convert.home.py
Normal file → Executable file
21
convert.home.py
Normal file → Executable file
@ -1,3 +1,6 @@
|
|||||||
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
import sys
|
||||||
import fs
|
import fs
|
||||||
import csv
|
import csv
|
||||||
|
|
||||||
@ -19,9 +22,9 @@ def deparseRow(row):
|
|||||||
Keys = []
|
Keys = []
|
||||||
def convert(row):
|
def convert(row):
|
||||||
global Keys
|
global Keys
|
||||||
|
|
||||||
print(row)
|
print(row)
|
||||||
|
|
||||||
#row['Datum'] = f'{row["Datum"][0:4]}-{row["Datum"][4:6]}-{row["Datum"][6:8]}'
|
#row['Datum'] = f'{row["Datum"][0:4]}-{row["Datum"][4:6]}-{row["Datum"][6:8]}'
|
||||||
row['Datum'] = row['Datum'].split('-')
|
row['Datum'] = row['Datum'].split('-')
|
||||||
row['Datum'] = f'{row["Datum"][2]}-{row["Datum"][1]}-{row["Datum"][0]}'
|
row['Datum'] = f'{row["Datum"][2]}-{row["Datum"][1]}-{row["Datum"][0]}'
|
||||||
@ -106,12 +109,12 @@ def convert(row):
|
|||||||
|
|
||||||
return row
|
return row
|
||||||
|
|
||||||
def main():
|
def main(inputFile):
|
||||||
global Keys
|
global Keys
|
||||||
rows = []
|
rows = []
|
||||||
csv.register_dialect('2004', delimiter=';', quoting=csv.QUOTE_ALL)
|
csv.register_dialect('2004', delimiter=';', quoting=csv.QUOTE_ALL)
|
||||||
csv.register_dialect('new', delimiter=',', quoting=csv.QUOTE_NONE)
|
csv.register_dialect('new', delimiter=',', quoting=csv.QUOTE_NONE)
|
||||||
with open('input.csv', mode ='r') as file:
|
with open(inputFile, mode ='r') as file:
|
||||||
imp = csv.reader(file, 'new')
|
imp = csv.reader(file, 'new')
|
||||||
|
|
||||||
headers = False
|
headers = False
|
||||||
@ -200,7 +203,15 @@ def main():
|
|||||||
# yield parseRow(row, headers)
|
# yield parseRow(row, headers)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
|
||||||
|
print(sys.argv)
|
||||||
|
|
||||||
|
if (len(sys.argv) == 2):
|
||||||
|
main(sys.argv[1])
|
||||||
|
else:
|
||||||
|
print("please use one orgument for the path to the imputfile")
|
||||||
|
# if __name__ == '__main__':
|
||||||
|
# main()
|
||||||
|
|
||||||
|
|
||||||
# "Datum";"Naam / Omschrijving";"Rekening";"Tegenrekening";"Code";"Af Bij";"Bedrag (EUR)";"Mutatiesoort";"Mededelingen";"Saldo na mutatie";"Tag"
|
# "Datum";"Naam / Omschrijving";"Rekening";"Tegenrekening";"Code";"Af Bij";"Bedrag (EUR)";"Mutatiesoort";"Mededelingen";"Saldo na mutatie";"Tag"
|
||||||
|
|||||||
Reference in New Issue
Block a user