make inputfile an argument
This commit is contained in:
parent
0dedf0967f
commit
f114faf2d2
13
convert.py
13
convert.py
@ -1,5 +1,6 @@
|
|||||||
import fs
|
import fs
|
||||||
import csv
|
import csv
|
||||||
|
import sys
|
||||||
|
|
||||||
def parseRow(row, header):
|
def parseRow(row, header):
|
||||||
d = {}
|
d = {}
|
||||||
@ -109,11 +110,11 @@ def convert(row):
|
|||||||
|
|
||||||
return row
|
return row
|
||||||
|
|
||||||
def main():
|
def main(inputFile):
|
||||||
global Keys
|
global Keys
|
||||||
rows = []
|
rows = []
|
||||||
csv.register_dialect('thing', delimiter=';', quoting=csv.QUOTE_ALL)
|
csv.register_dialect('thing', delimiter=';', quoting=csv.QUOTE_ALL)
|
||||||
with open('coolhaven_2022.csv', mode ='r') as file:
|
with open(inputFile, mode ='r') as file:
|
||||||
imp = csv.reader(file, 'thing')
|
imp = csv.reader(file, 'thing')
|
||||||
|
|
||||||
headers = False
|
headers = False
|
||||||
@ -202,7 +203,13 @@ 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")
|
||||||
|
|
||||||
|
|
||||||
# "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