Coloring print lines

Sybren Stuvel sybrenUSE at YOURthirdtower.imagination.com
Mon Aug 25 10:04:29 EDT 2003


Sami Viitanen enlightened us with:
> Is there an easy way to make script print text with differents colors to
> screen (shell)?

Sure, just use ANSI codes.

> I mean a script that can for example print lines in red if some
> error occurs in executing some information..

Example:

print "\033[31;1mError:\033[0m some message"

Sybren
-- 
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
safety labels off of everything and let the problem solve itself? 




More information about the Python-list mailing list