Char handling DOS vs Linux?
David Lees
debl.spammono.nospammy at world.std.com
Tue Sep 19 21:17:25 EDT 2000
I wrote a short piece of python code running under 1.5.2 for striping
out those extra carriage returns that DOS editors stick into text. When
I run this on my Linux box all works fine. When I run the same code
under Win 95 it does nothing. It appears from using the debugger that
the '\r' carriage returns are never seen when running under Windows. Is
there a different Python I/O function I should be using to see ALL the
charaters in a file?
Thanks in advance.
david lees
# Read input file 1 character at a time and send to output if it is not
a CR (0D='\r')
while 1:
s=input.read(1)
if not s:
break
if s != '\r':
output.write(s)
More information about the Python-list
mailing list