stripping blanks

Duncan Booth duncan.booth at invalid.invalid
Tue May 2 17:35:24 CEST 2006

Fulvio wrote:

> Alle 17:06, martedì 02 maggio 2006, seeker ha scritto:
>>      printLine = line.rstrip("\n")
> I think that nobody considered if the text has (\r) or (\r\n) or (\n)
> at the end of the line(s).
You think wrongly.

The suggested code opens the file in text mode so the line endings are 
automatically normalised to '\n'.

More information about the Python-list mailing list