Python Forum

Full Version: Coloured text in the terminal works in Linux but not Windows
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm using the syntax "\033[31;40mRed\033[37;40m" for coloring text in the terminal, and it works perfectly on my Linux laptop, but when I installed Python on my Windows PC and tried running my code, the color syntax just printed as-is. Is there another module I have to install for it to work on Windows?
That ANSI escape sequences are going to work on terminals under linux, not Windows command prompt. I dont think the default windows prompt supports escape sequences, but i could be wrong. For windows, people usually use a library such as colorama.

You could also install either Cmder, ConEmu, ANSICON or Mintty (used by default in GitBash and Cygwin) to add coloring support to your Windows command console with escape sequences
Thanks for the info! I'll have to check those out.