Removing newlines from string on windows (without replacing)

Tom tom.sully at
Sat Jul 25 21:27:37 CEST 2009

This is my first post to this mailing list, so hi :)

I have an annoying problem. While I mainly use Linux when I distribute
this program to friends and on the internet, it'll get used on Windows.
So, I tested my python program on my Windows Vista dual boot, running
the same version of python (2.6) as my Linux, and got an error at the
following code.

s = sauce.replace("\n", "")

Sauce is a string, read from a file, that I need to remove newlines
from. This code works fine in Linux, but not in Windows. rstrip("\n")
won't work for me, so anybody know how to get this working on Windows?

Thanks! :D

--print "Tom"

More information about the Python-list mailing list