Hi, I have a file with this content:
xxx xx x xxx
1
0
0
0
1
1
0
(many more 1's and 0's to follow)
y yy yyy yy y yyy
The x's and y's are FIXED and known words which I will ignore, such as
"This is the start of the file" and "This is the end of the file". The
dig
Thanks Kent. The code looks reasonable, but the result is that, the
output file comes out identical as the input file, with all the
and remaining inside.
--
http://mail.python.org/mailman/listinfo/python-list
I've changed the code a little bit and works fine now:
inf = open('input.txt')
out = open('output.txt', 'w')
skips = [
'xxx xx x xxx',
'y yy yyy yy y yyy']
for line in inf:
flag = 0
for skip in skips:
if skip in line:
flag = 1
continue
i
Hi, I'm reading a file line by line, and whenever a line is not
consisted of a single number (such as 0.315), I want to discard that
line (and store only the single numbers).
For example,
0.315
discarded this line of text
3.8
-1.44
forget about me also
2.6
Then I want to store only the four num
Hi, I have a file with this content:
z zzz z
...
xxx xx x 34.215
zzz zz
...
"x" and "z" are letters.
The lines with "z" are trash, and only the lines with "x" are
important. I want to extract the number (34.215 in this case) behind
the letters x, and store i