Printing with colors in a portable way

Aahz aahz at
Mon Aug 3 04:52:14 CEST 2009

In article <33e19169-19b4-497a-b262-2bcf7b5637d5 at>,
Robert Dailey  <rcdailey at> wrote:
>Anyone know of a way to print text in Python 3.1 with colors in a
>portable way? In other words, I should be able to do something like
>print_color( "This is my text", COLOR_BLUE )
>And this should be portable (i.e. it should work on Linux, Mac,

Much as I hate to say, use a cross-platform GUI -- Tkinter comes with
Python, and you can also use SDL via PyGame, wxWindows, pyQT, PyOpenGL,
and so on.  If that's not an option, you should have said "command-line
program".  ;-)
Aahz (aahz at           <*>

"...string iteration isn't about treating strings as sequences of strings, 
it's about treating strings as sequences of characters.  The fact that
characters are also strings is the reason we have problems, but characters 
are strings for other good reasons."  --Aahz

More information about the Python-list mailing list