|
@@ -1,7 +1,3 @@
|
|
|
-#if(+ oder - merge with next line)
|
|
|
-
|
|
|
-#merge all values into one until 4 values or until no integer/string with number
|
|
|
-
|
|
|
import csv
|
|
|
import re
|
|
|
|
|
@@ -9,23 +5,30 @@ with open('merged.csv') as csv_file:
|
|
|
csv_reader = csv.reader(csv_file, delimiter=',')
|
|
|
line_count = 0
|
|
|
durchmesser = False
|
|
|
+ vorzeichen = "nix"
|
|
|
text = True
|
|
|
for row in csv_reader:
|
|
|
+ #row[1] = row[1].replace(",",".")
|
|
|
if durchmesser:
|
|
|
print("Durchmesser: " + row[1])
|
|
|
durchmesser = False
|
|
|
+ #continue
|
|
|
if row[1] == "%%c":
|
|
|
durchmesser = True
|
|
|
- num_format = re.compile("^[\-]?[1-9][0-9]*\.?[0-9]+$")
|
|
|
- isnumber = re.match(num_format, row[1])
|
|
|
+ if row[1] == "-" or row[1] == "+":
|
|
|
+ vorzeichen = row[1]
|
|
|
+ #print(vorzeichen)
|
|
|
+ isnumber = re.findall(r"\d*\,\d+", row[1])
|
|
|
if isnumber:
|
|
|
- print(row[1])
|
|
|
- try:
|
|
|
- if row[1].isFloat():
|
|
|
- print(row[1])
|
|
|
- except:
|
|
|
- pass
|
|
|
+ if vorzeichen != "nix":
|
|
|
+ print(vorzeichen + isnumber[0])
|
|
|
+ else:
|
|
|
+ print(isnumber[0])
|
|
|
+ vorzeichen = "nix"
|
|
|
+
|
|
|
if row[1][0] == "?":
|
|
|
print("+/- " + row[1][1:])
|
|
|
+
|
|
|
line_count += 1
|
|
|
print(f'Processed {line_count} lines.')
|
|
|
+
|