Colour of output text
Nobody
nobody at nowhere.com
Sat Jul 11 02:24:02 EDT 2009
On Fri, 10 Jul 2009 09:23:54 +0000, garabik-news-2005-05 wrote:
>>> I would like to learn a way of changing the colour of a particular
>>> part of the output text. I've tried the following
>
>> On Unix operating systems this would be done through the curses interface:
>>
>> http://docs.python.org/library/curses.html
>
> Or using ANSI colour codes:
>
> colours = {
> 'none' : "",
> 'default' : "\033[0m",
> 'bold' : "\033[1m",
[snip]
> # non-standard attributes, supported by some terminals
This comment should have appeared immediately after "none" ;)
Hard-coding control/escape sequences is just lame. Use the curses modules
to obtain the correct sequences for the terminal.
More information about the Python-list
mailing list