Skip to content Skip to sidebar Skip to footer

Not Able To Print In Color On Terminal

As given in an answer on Print in terminal with colors using Python? , I am trying to print in color on console/terminal using following code: RED = '\e[31m' NORMAL = '\e[0m' prin

Solution 1:

You have found a wrong answer; \e is not a valid escape sequence in Python. In some echo implementations, \e is an escape sequence for the ASCII ESC character, but in Python you need to use a different notation.

The rest of the answers on that page use correct forms, either \x1b or \033.

Post a Comment for "Not Able To Print In Color On Terminal"