ich brauche mal wieder die Hilfe des Forums.
Ich habe eine xyz Datei einer Punktwolke und möchte diese Sortieren, das heißt alle 2er Werte (der letzte Wert in einer Zeile) behalten, der Rest kann weg.
Ein Auszug aus der Datei:
Code: Alles auswählen
x;y;z;c
370866.86;5721834.73;66.47;58
370868.86;5721834.73;66.51;58
370870.86;5721834.73;66.61;58
370868.86;5721832.73;66.58;58
370870.86;5721832.73;66.65;58
370658.3;5721562.11;67.33;58
370658.3;5721560.11;67.37;58
370660.3;5721560.11;67.37;58
370660.3;5721558.11;67.45;58
370660.3;5721556.11;67.52;58
370662.3;5721556.11;67.54;2
370622.74;5721389.32;68.28;2
370622.74;5721387.32;68.25;2
370211.71;5721293.98;69.77;2
370211.71;5721291.98;69.74;2
370211.71;5721289.98;69.71000000000001;2
370213.71;5721289.98;69.74;2
370211.71;5721287.98;69.7;2
370278.03;5721626.3100000005;73.11;2
370278.03;5721644.16;74.12;2
Code: Alles auswählen
with open ("Test.xyz", "r") as file, open("Test_B.xyz", "w") as out:
for line in range(1):
next(file)
for line in file:
x1 = line.find(";")
x2 = line.find(";",x1+1)
x3 = line.find(";",x2+1)
if int(line[x3+1:])==2:
print(line)
y1 = round(float(line[0:x1-1]),3)
y2 = round(float(line[x1+1:x2-1]),3)
y3 = round(float(line[x2+1:x3-1]),3)
list = []
list.append(str(y1))
list.append(str(y2))
list.append(str(y3))
print(list)
sep = ';'
line = sep.join(list)
out.write(line)
Ich weiß einfach nicht wohin das
Code: Alles auswählen
'\n’
Gruß Kai