The standard command to color the output of
It has to do with the changes that accompany the newest versions of Python 3, I believe.
My System: Python 3.7.3, Windows 10, IDLE.
Although it works fine on
Python 2.7, with
Python 3.7 it simply doesn’t function.
print("3[1;32;40m Bright Green n")in IDLE as shown in this article outputs
[1;32;40m Bright Green. On the contrary this works fine on an online
Python 2parser giving a colored background.
A correction was found that on
Python 3the escape character is
3. A modified expression inside the
print("x1b[1;32;40m Bright Green n")in IDLE outputs
[1;32;40m Bright Greenand no colored background.
print("3[1;32;40m Bright Green n")on a
pyfile still outputs
- Since there are differences between my local system I tried to run on an online
print("3[1;32;40m Bright Green n")and it gave me
[1;32;40m Bright Green.
This use of ANSI escape codes is mostly offered as a solution in links.
What do I do wrong?
Source: Python-3x Questions