stripping blanks

Fredrik Lundh fredrik at pythonware.com
Tue May 2 11:39:46 EDT 2006


Fulvio wrote:

> > 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).

if it's opened in text mode (the default), and is a text file, it will
always have "\n" at the end of the line.

</F>






More information about the Python-list mailing list