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
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
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
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
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
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
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
>
> 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
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()
>
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
10 matches
Mail list logo