Python Exercise Example 35
**Question:** Set text color.
**Analysis:** None.
Example
#!/usr/bin/python
-- coding: UTF-8 --
class
bcolors
:
HEADER
=
'
\0
33[95m
'
OKBLUE
=
'
\0
33[94m
'
OKGREEN
=
'
\0
33[92m
'
WARNING
=
'
\0
33[93m
'
FAIL
=
'
\0
33[91m
'
ENDC
=
'
\0
33[0m
'
BOLD
=
'
\0
33[1m
'
UNDERLINE
=
'
\0
33[4m
'
(
bcolors
.
WARNING
"
Warning color and font?
"
bcolors
.
ENDC
)
The output of the above example is:
警告的颜色字体? # 浅黄色
Python 100 Examples