Replacing control characters.
Greg Jorgensen
gregj at pobox.com
Mon Jan 22 23:12:59 EST 2001
Use an editor that does this for you (EditPlus on Windows, for
example), or can do it easily (vi/vim on Linux or Windows). That's the
most efficient way. A text editor that cares about line ending
variations in this decade is lame (unless you really care about the
various flavors of line endings).
In article <94ifec$ggt$1 at nnrp1.deja.com>,
johnvert at my-deja.com wrote:
> Hi,
>
> I want to replace actual Ctrl keys that are in files. For example, I
> saved in Netscape (Linux) an HTML file and when I open it in a text
> editor there are a bunch of ^M characters around (probably because the
> file was processed on Windows, which uses a different line ending for
> textfiles--right?). I want to remove all of these characters, but
since
> it's not an actual caret (^) and a letter M, but the *Ctrl* character
> C-M I don't know how to refer to them in a regexp. How can I? Also,
> what would be the most efficient way to do this in Python (e.g. use
> regexp functions to maybe module string will do?)
>
> Thanks,
> -- John
>
> Sent via Deja.com
> http://www.deja.com/
>
--
Greg Jorgensen
Portland, Oregon, USA
gregj at pobox.com
Sent via Deja.com
http://www.deja.com/
More information about the Python-list
mailing list