How to get rid the new line

Guido Goldstein guido.goldstein at a-nugget.de
Fri Jun 28 01:17:18 EDT 2002


Hi!

On 27 Jun 2002 16:38:02 -0700
  Paul Rubin <phr-n2002b at NOSPAMnightsong.com> wrote:
[...]
> If you don't mind removing all trailing whitespace, there's also
> 
>   line = line.strip()
> 
> or more portably
> 
>    import string
>    line = string.strip(line)

If you really would like to remove *trailing* whitespace you better
should use rstrip().
The strip() method strips from both sides!

Just my 2 cents.

HAND
  Guido



More information about the Python-list mailing list