Jay, PLEASE shorten your posts by removing all unnecessary quoting.

On 4/5/07, Jay Mutter III <[EMAIL PROTECTED]> wrote:

> Whether I attempt to just strip the string or attempt to
>
> if line.endswith('No.\r'):
>      line = line.rstrip()
>
> It doesn't work.

That's because you assume the linefeeds to be \r only. If you really
want to strip endings on strings ending with "No.", then do this
workaround:

foo = line.rstrip()
if foo.endswith("No."):
  line = foo

Never assume line breaks to be of any type, because there are four of
them: \n, \r, \n\r, \r\n. It would be a waste of code to check for all
four, kind of reimplementing the wheel again.


-- 
- Rikard - http://bos.hack.org/cv/
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to