[Tutor] removing line ends from Word text files
Christian Meesters
CMeesters at ucdavis.edu
Sat Jul 10 04:36:01 CEST 2004
Hi
Right now I have the problem that I want to remove the MS Word line end
token from text files: When saving a text file as 'text only' line ends
are displayed as '^M' in a shell (SGI IRIX (tcsh) and Mac (tcsh or
bash)). I want to get rid of these elements for further processing of
the file and have no idea how to access them in a Python script. Any
idea how to replace the '^M' against a simple '\n'? (I already tried
'\r\n' and various other combinations of characters, but apparently all
aren't '^M'.) '^M' is one character.
As supplementary information: I'm using MacOSX (version 10.3.4) with
Python 2.3 or SGI Irix with Python 2.1.1 .
Thanks a lot in advance,
Christian
More information about the Tutor
mailing list