Attempting to parse free-form ANSI text.

Jean-Paul Calderone exarkun at divmod.com
Sun Oct 22 01:06:34 EDT 2006


On Sun, 22 Oct 2006 00:34:14 -0400, "Michael B. Trausch" <mike$#at^&nospam!%trauschus at bag.python.org> wrote:
>Alright... I am attempting to find a way to parse ANSI text from a
>telnet application.  However, I am experiencing a bit of trouble.
>
>What I want to do is have all ANSI sequences _removed_ from the output,
>save for those that manage color codes or text presentation (in short,
>the ones that are ESC[#m (with additional #s separated by ; characters).
> The ones that are left, the ones that are the color codes, I want to
>act on, and remove from the text stream, and display the text.

http://originalgamer.cvs.sourceforge.net/originalgamer/originalgamer/originalgamer/ansi.py?revision=1.12&view=markup may be of some interest.

Jean-Paul



More information about the Python-list mailing list