Search code examples
pythonprintingconsolecolorama

Why colored console text in Python prints out color codes in Windows?


I did not managed to find similar question, if any exists Im sorry and I would be thankful for link.

Basing on this tutorial I am trying to manage to print with Python 3.x in console with a color. A simple example: print('\033[2;31;43m CHEESY')

It should print: enter image description here

But instead of this it prints out: enter image description here

Same results I get when using colorama or other libs.

System: Windows 10, Python: 3.10

Tried already:

  • colorama
  • init(convert=True)
  • os.system("cls" or "clear")
  • os.system("")

Solution

  • Allright, I found a solution on Superuser

    Long story short, need to enable ANSI in Windows 10:

    enter image description here