Removing newlines from string on windows (without replacing)

Tom Tom.sully at gmx.com
Sun Jul 26 19:13:44 CEST 2009


Sorry for not providing enough information - and Rhodri, for sending
my second message I used the GMX webmail client rather than my usual
Linux client as I was testing it on windows. That must have screwed it
up, I need to download Thunderbird on Mozzila.

The thing that was messing it up was that the endlines are handled
differently on each each OS, so I changed the code to strip the
endlines to be:

    if os.name == "nt":
        s = sauce.rstrip("\r\n")
    else:
        s = sauce.replace("\n", "")

This works fine now, (os.name returns nt on windows and posix on
linux)
Thanks for the help, and sorry for slow response and lack of detail,
I'm still trying to get used to this usenet thing :P

--
print "Tom"



More information about the Python-list mailing list