[Tutor] display text in colors
Luke Paireepinart
rabidpoobear at gmail.com
Mon Jan 1 20:55:58 CET 2007
LandSurveyor wrote:
> I would like to direct a python script to display 'print' strings in various (chosen) colors; for example:
>
> print \
> """
> color this line blue # in the printout display-be it screen or hardcopy
> color this line green # in the printout display-be it screen or hardcopy
> """
> what I tried doing was:
> import os
> then the line...<os.system('\[\e[31;1m\]')> just before the print command (I borrowed this formatting from my $PS1 format.
>
> Nadda. Didn't work. What might I try?
>
Uh, I think it's pretty important what operating system you're using here.
Could you let us know before we try to help further?
Thanks,
-Luke
More information about the Tutor
mailing list