2
I’m trying to write a code to read a . txt file and extract numeric coordinates, but this file contains lines with text as well. I’m unable to filter. see a part of the file.
So far I’ve managed to write the following:
filename = 'arquivo.txt'
with open(file_name) as f:
lines = f.readlines()
for line in lines:
values = line.split()
Now I try to filter only the values of the coordinates of lines 236, 244, 250, 256... could use the value of the first column to filter because it is standard, for example: 110 on line 236 and 105, 100, 35 of the other lines. Since the coordinates x y z are the next step would be to subtract the fifth column from the second - the sixth from the third - and the seventh from the fourth.
Blz, but you failed to explain your doubt, where you need help, what you couldn’t do, and you doubt it. Try to put in and out expected, this helps a lot. If you want to filter only the values of the coordinates on lines 236, 244, 250 and 256 it is quite simple. But I imagine that’s not it
– Gabriel Belini