I am trying to color a string, but it doesn't work I've tried this, but it doesn't work at the cmd window
print '\033[1;32mGreen like Grass\033[1;m'
Could someone tell me why?
In pycharm command window it does work
I am trying to color a string, but it doesn't work I've tried this, but it doesn't work at the cmd window
print '\033[1;32mGreen like Grass\033[1;m'
Could someone tell me why?
In pycharm command window it does work
It's probably to do with your terminal settings. When I run
python -c "print('\033[1;32mGreen like Grass\033[1;m')"
I get a green string. What value does your TERM environment variable have?
echo $TERM
xterm-256color
On Linux the termcap
program handles terminal capabilities. You may just need to match TERM setting to your actual terminal emulator.