There is a file with a list of numbers.
Example:
**AK
v 0.00o 0.00 0.00 0.00 0.00 0.00 0.00
750.00 0.00 0.00 0.00 0.00 0.00 0.00
750.00 43.00 0.00 0.00 0.00 0.00 0.00
585.00 43.00 -7.00 0.00 0.00 0.00 0.00
-16611181.71 -90.16t -7.00 0.00 0.00 0.00 0.00
585.00 57.00 0.00 0.00 0.00 0.00 0.00
750.00 57.00 0.00 0.00 0.00 0.00 0.00
750.00 100.00 0.00 0.00 0.00 0.00 0.00
0.00 100.00 0.00 0.00 0.00 0.00 0.00
0.00 56.99 0.00 0.00 0.00 0.00 0.00
165.00 56.99 -7.00 0.00 0.00 0.00 0.00
16612362.17 344.30t -7.00 0.00 0.00 0.00 0.00
165.00 42.99 0.00 0.00 0.00 0.00 0.00
0.00 42.99 0.00 0.00 0.00 0.00 0.00
0.00 0.00 0.00 0.00 0.00 0.00 0.00**
You need to remove the entire line from it, where the number > 12000 or the number < -12000.
I tried to split the string into substrings and compare the value, but nothing worked 🙁
for line in infile:
if line.startswith(' '):
str = line.split()
numbers = int(str[0])
if not (numbers < 12000) or not (numbers > -12000):
outfile.write(line)
New contributor
Кирилл Тофанило is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1