# [Python] [34] [demo experimental practice examples] [color settings of the text]

Original title:

Text color.

 

 

My code

# ! / Usr / bin / Python 
# encoding = UTF-8 
# - * - Coding: UTF-8 - * - 

# text color. 
class bcolors: 
    the HEADER = ' \ 033 [95m ' 
    OKBLUE = ' \ 033 [94m ' 
    OKGREEN = ' \ 033 [92m ' 
    the WARNING = ' \ 033 [93m ' 
    FAIL = ' \ 033 [91m ' 
    ENDC = ' \ 033 [0m ' 
    BOLD = ' \ 033 [1M ' 
    UNDERLINE= ' \ 033 [4M ' 

Print (bcolors.WARNING + " DDDDD " + bcolors.ENDC)
 # Print bcolors.WARNING + "warning color font?" + Bcolors.ENDC

 

Output results:

 

 

I might consider using cmd it does not support color display, the expected effect did not occur.

 

 

 

The original title given answers:

 

 

 


-------- (I am dividing line) --------

reference:

1. RUNOOB.COM:https://www.runoob.com/python/python-exercise-example35.html

 

 

Remarks:

Initial modified: October 6, 2019 12:26:21

Environment: Windows 7 / Python 3.7.2

 

Guess you like

Origin www.cnblogs.com/kaixin2018/p/11626997.html