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 line
    print line

and what I expect that should be correct, remove CR+LF,
gives me one character too much removed
    print line[,-2]

while this gives what I need ???
    print line[,-1]

Is it correct that the 2 characters CR+LF are converted to 1 character ?
Is there a more automatic way to remove the EOL from the string ?

thanks,
Stef Mientki
>>> abcd = 'abcdedff . \n'
>>> abcd
'abcdedff . \n'
>>> print abcd
abcdedff .

>>>* from string import strip*
>>> print abcd.strip()
abcdedff .
>>> a = abcd.strip()
>>> a
'abcdedff .'
>>>

sph
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to