Outputs a colored string that displays the part to highlight. The test, which is feasible in Pycharm, is not available on the Windows command line. The cause is unknown.
Method:
Format:"\033[display mode; background color m need to change the color of the string \033[display mode M"Example:"\033[1;31;47m requires a variable color string \033[0m"<1-highlight 31 foreground color Red 47 background black--a string that needs to be colored--0-Cancel color settings >Description: Color of foreground background color---------------------------------------30 40Black31 41Red32 42Green33 43Yellow color34 44Blue35 45Purplish Red36 46Cyan Blue37 47meaning of white display mode-------------------------0 Terminal default settings (that is, color settings are canceled)1Highlight Display4Use underline5flashing7anti-white display8 Not visible
Test:
Print ("\033[1;31;40m needs to change the color of the string \033[0m")
Results:
Python output string with color