python: When I try to change the color using termcolor?[32mtest?][0m]

Asked 2 years ago, Updated 2 years ago, 46 views

I am a beginner studying Python using VS code.
When I try to change the color with termcolor, it says ?[32mtest?[0m.
I would appreciate it if someone could tell me.

from termcolor import colored

print('test')
print('test', 'green')

python visual-studio

2022-09-30 16:06

1 Answers

?[0m is probably the ESC[0m, which is called the vt100 terminal escape sequence.Unfortunately, the Windows console does not support this vt100 escape sequence, although this is one of the procedures that was commonly used in the past on the "terminal"Therefore, the color of the Windows console looks the same.In short, your settings are for Linux devices (vt100) and not for Windows consoles.

Use colorama to color on the Windows console.
https://stackoverflow.com/questions/21858567/


2022-09-30 16:06

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.