Replacing control characters.

johnvert at my-deja.com johnvert at my-deja.com
Mon Jan 22 18:24:07 EST 2001


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/



More information about the Python-list mailing list