Colored text in Linux

Cedric Adjih adjih at crepuscule.com
Fri Sep 22 18:49:49 CEST 2000


Brian Geddes <brian.j.geddes at intel.com> wrote:
> All -
>
> I want to be able to print out colored text to the screen from inside a
> Python script in Linux.  I figure this is just a matter of using the proper
> escape codes, but I'm not sure where to find them or if I'll have to use
> anything other than the basic print() function.  Thanks in advance...

  For being portability, you can use the curses/ncurses modules.
  Otherwise you can use print, and the codes from console_codes(4):
  <http://linux.com/development/man/4/console_codes>
  This is for console (i.e. text mode), but some of the codes also work
for xterm, Eterms, ...
  
-- Cedric



More information about the Python-list mailing list