Python Forum

Full Version: Change Text Color Output in Python
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm trying to change the output text to green and the background to blue using this code:

    print("\033[1;32;44m******************************************************")
    print("\033[1;32;44m* Terminate Instance Operations in AWS Are Complete. *")
    print("\033[1;32;44m******************************************************")
But the output is the the default powershell white and the numeric codes are visible. This is how the output looks:

Error:
[1;32;44m****************************************************** [1;32;44m* Terminate Instance Operations in AWS Are Complete. * [1;32;44m******************************************************
What am I doing wrong?
Those look like ansi color escapes, which don't work on windows afaik.
If you need a cross-platform way to display colored output, you should take a look at colorama.
(Mar-04-2019, 07:56 PM)stranac Wrote: [ -> ]Those look like ansi color escapes, which don't work on windows afaik.
If you need a cross-platform way to display colored output, you should take a look at colorama.


Thanks! I got colorization of my python scripts text output to work on windows and linux with Colorama! Good stuff! I appreciate the tip!