string operations (ctrl characters)

Hans Nowak hnowak at
Thu Aug 16 15:30:57 CEST 2001

>===== Original Message From "Richard Brodie" <R.Brodie at> =====
>"Hans Nowak" <hnowak at> wrote in message
>news:mailman.997950925.22550.python-list at
>> You don't *need* regexen for this, though. One approach could be, scanning 
>> string for "acceptable" characters, and replacing anything else with some
>> default character, or removing it.
>That would not be best in this case, as he is seeing ANSI escape sequences.
>You often see things like <ESC>[23m ; there is a general syntax for them so
>a good emulator should be able to parse and ignore unrecognised codes.
>Unfortunately, there is no obvious "end escape sequence" delimiter, so its
>not entirely trivial.

Oh! I am using a web-based mail reader right now, and could not see some of 
the sequences he quoted, thus not realizing it was ANSI. (Some module that 
parses and shows text with ANSI-codes is on my to-do list, but I have nothing 
practical or working yet... <frown>)

--Hans Nowak

More information about the Python-list mailing list