|
|
@@ -32,6 +32,8 @@ def convert_pdf_to_txt(path):
|
|
|
|
|
|
regex = r"^Tour Nr:\n\n(\d*)\n\nAbfahrt:.*?StellPl.Maut.*?^(\d*(,\d*)?|0)\sKM$"
|
|
|
|
|
|
+
|
|
|
+total = 0.0
|
|
|
os.chdir("./")
|
|
|
print("moin")
|
|
|
with open("ergebnis.csv", 'w', newline='') as csvfile:
|
|
|
@@ -43,12 +45,9 @@ with open("ergebnis.csv", 'w', newline='') as csvfile:
|
|
|
print("Beginne mit " + file + " alles guddes!")
|
|
|
spamwriter.writerow([str(file)])
|
|
|
out = convert_pdf_to_txt(file)
|
|
|
- file = open("testfile.txt","w", encoding='utf-8')
|
|
|
-
|
|
|
- file.write(out)
|
|
|
-
|
|
|
-
|
|
|
- file.close()
|
|
|
+ #file = open("testfile.txt","w", encoding='utf-8')
|
|
|
+ #file.write(out)
|
|
|
+ #file.close()
|
|
|
matches = re.finditer(regex, out, re.MULTILINE | re.DOTALL)
|
|
|
|
|
|
|
|
|
@@ -62,6 +61,8 @@ with open("ergebnis.csv", 'w', newline='') as csvfile:
|
|
|
daily = daily + float(match.group(2).replace(",","."))
|
|
|
i = i+1
|
|
|
print(daily)
|
|
|
- spamwriter.writerow(["Gesamt"] + [str("=\"" + str(round(daily, 2)) + "\"")])
|
|
|
+ total = total + daily
|
|
|
+ spamwriter.writerow(["Gesamt (Tag)"] + [str("=\"" + str(round(daily, 2)) + "\"")])
|
|
|
spamwriter.writerow([])
|
|
|
print("ok")
|
|
|
+ spamwriter.writerow(["Gesamt (Monat)"] + [str("=\"" + str(round(total, 2)) + "\"")])
|