Re: Removing newlines from string on windows (without replacing)

2009-07-26 Thread Tom
> (Even if it so happens sauce > will only ever have LFs at the end, it's still better to use the > method that is closest to your intended meaning.) Oh, you're right. I'll change that now. I suppose removing all endlines will be better, incase, somehow, endlines in the middle of the line arrises.

Re: Removing newlines from string on windows (without replacing)

2009-07-26 Thread Aahz
In article , Tom wrote: > >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

Re: Removing newlines from string on windows (without replacing)

2009-07-26 Thread John Yeung
On Jul 26, 1:13 pm, Tom wrote: > 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", "")

Re: Removing newlines from string on windows (without replacing)

2009-07-26 Thread Tom
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

Re: Removing newlines from string on windows (without replacing)

2009-07-26 Thread Ulrich Eckhardt
Tom wrote: > 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? I'm pretty sure this works regardless o

Re: Removing newlines from string on windows (without replacing)

2009-07-25 Thread Rhodri James
On Sat, 25 Jul 2009 20:27:37 +0100, Tom wrote: 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

Removing newlines from string on windows (without replacing)

2009-07-25 Thread Tom
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)