[Tutor] comment stripper script
Terry Carroll
carroll at tjc.com
Sun Jan 25 22:36:58 EST 2004
On Sun, 25 Jan 2004, kevin parks wrote:
> Can anyone see why? I can't. Perhaps i just need another, more fresh,
> pair of eyes.
Yep, I think so:
> line.strip()
Unless I miss my guess, this is your problem. The above wil not modify
line; you need:
line = line.strip()
Otherwise, when you get to the next line of code:
> if not (line.startswith(';') or line.startswith('c') or
> line.startswith('#')):
This condition fails, because the leading blanks are stil there.
--
Terry Carroll
Santa Clara, CA
carroll at tjc.com
Modell delendus est
More information about the Tutor
mailing list