Replacing control characters.

Eric Rochester ericr at us.english.uga.edu
Mon Jan 22 19:53:30 EST 2001


There's already a script that does exactly this included with the standard
distribution. It's located at Tools/Scripts/crlf.py .

No point reinventing the wheel,
Eric

On Mon, Jan 22, 2001 at 11:24:07PM +0000, 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/
> -- 
> http://mail.python.org/mailman/listinfo/python-list

-- 
Eric Rochester
English Department
The University of Georgia
Athens, Georgia 30602

----

"I have a cunning plan!"
		--Baldric





More information about the Python-list mailing list