Thanks for the suggestions.
The solution I liked most was to prevent the lines from appearing in
the first place!!
--
http://mail.python.org/mailman/listinfo/python-list
Felipe Almeida Lessa schrieb:
> Em Sex, 2006-04-14 às 20:33 +0200, Diez B. Roggisch escreveu:
>> def read_lines(inFile):
>> fg = iter(inFile)
>> for line in fg:
>> if "pmos4_highv" in line:
>> fg.next()
>> else:
>> yield line
>
> Just be aware
Em Sex, 2006-04-14 às 20:33 +0200, Diez B. Roggisch escreveu:
> def read_lines(inFile):
> fg = iter(inFile)
> for line in fg:
> if "pmos4_highv" in line:
> fg.next()
> else:
> yield line
Just be aware that the "fb.next()" line can raise an Stop
Jacob Rael schrieb:
> I am new to python and I love it. I am hacking a file. I want to not
> print a line if it contains the word 'pmos4_highv'. I also don't want
> to print the next line. The following code works but it "smells bad"
> and just doesn't look right. I was reading about generators. If
I am new to python and I love it. I am hacking a file. I want to not
print a line if it contains the word 'pmos4_highv'. I also don't want
to print the next line. The following code works but it "smells bad"
and just doesn't look right. I was reading about generators. If I was
using one, I could do