EOL character

2007-05-09 Thread HMS Surprise
I have two files apparently identical until I open them with winMerge which reports that they use different EOL characters. They are both jython scripts built using the maxq tool. When the one would not work I stripped it down to bare minimums and then duplicated it. The duplicate works, the origin

Re: getting rid of EOL character ?

2007-04-28 Thread John Machin
On Apr 28, 7:25 pm, Michael Hoffman <[EMAIL PROTECTED]> wrote: > John Machin wrote: > > On 27/04/2007 11:19 PM, Michael Hoffman wrote: > >> stef wrote: > >>> hello, > > >>> In the previous language I used, > >>> when reading a line by

Re: getting rid of EOL character ?

2007-04-28 Thread Michael Hoffman
John Machin wrote: > On 27/04/2007 11:19 PM, Michael Hoffman wrote: >> stef wrote: >>> hello, >>> >>> In the previous language I used, >>> when reading a line by readline, the EOL character was removed. > > Very interesting; how did you disting

Re: getting rid of EOL character ?

2007-04-28 Thread Stef Mientki
hi John, >>> In the previous language I used, >>> when reading a line by readline, the EOL character was removed. > > Very interesting; how did you distinguish between EOF and an empty line? > Did you need to call an isEOF() method before each read? Yes indeed, and

Re: getting rid of EOL character ?

2007-04-27 Thread John Machin
On 27/04/2007 11:19 PM, Michael Hoffman wrote: > stef wrote: >> hello, >> >> In the previous language I used, >> when reading a line by readline, the EOL character was removed. Very interesting; how did you distinguish between EOF and an empty line? Did you need to ca

Re: getting rid of EOL character ?

2007-04-27 Thread Steven Howe
stef wrote: hello, In the previous language I used, when reading a line by readline, the EOL character was removed. Now I'm reading a text-file with CR+LF at the end of each line, Datafile = open(filename,'r') line = Datafile.readline() now this gives an extra empty

Re: getting rid of EOL character ?

2007-04-27 Thread Jim
If you have a recent Python, see the documentation for open on the library page for built-in functions. http://docs.python.org/lib/built-in-funcs.html Jim -- http://mail.python.org/mailman/listinfo/python-list

Re: getting rid of EOL character ?

2007-04-27 Thread stef
> > line = line.rstrip("\r\n") should take care of it. If you leave out > the parameter, it will strip out all whitespace at the end of the > line, which is what I do in most cases. thanks for the solution Michael, cheers, Stef -- http://mail.python.org/mailman/listinfo/python-list

Re: getting rid of EOL character ?

2007-04-27 Thread Michael Hoffman
stef wrote: > hello, > > In the previous language I used, > when reading a line by readline, the EOL character was removed. > > Now I'm reading a text-file with CR+LF at the end of each line, >Datafile = open(filename,'r')line = Datafile.readline() >

getting rid of EOL character ?

2007-04-27 Thread stef
hello, In the previous language I used, when reading a line by readline, the EOL character was removed. Now I'm reading a text-file with CR+LF at the end of each line, Datafile = open(filename,'r') line = Datafile.readline() now this gives an extra empty line print l