Python:print Display color display color format: \033[display mode, font color, background color m ... [\033[0m]
--------------------------------------------------------------------------------------Font Color | Background Color | Color Description-------------------------------------------30 | 40| Black 31 | | Red 32 | | Green 33 | | Yellow Color 34 | * | blue | | | purple | red | | | White-------------------------------------------
-------------------------------
Display Mode | Effect-------------------------------0 | Terminal default settings 1 | Highlight 4 | Use underscore 5 | Blink 7 | anti-white Display 8 | invisible
-------------------------------
Cases:
Print (' This isa \033[1;35m test \033[0m!' )print (' This isa \033[1;32;43m test \033[0m!' )print ('\033[1;33;44mthis is a test!\033[0m')
Output Result:
The print output does not break the line:
If Python is a 2.x version, add an English comma after the statement,print x, if Python is a 3.x version of print without a newline parameter end=""print (x, end="")
Cases:
Print ('he' ' # 'llo', end=')
Output Result:
Hello
Python--print