python print 彩色輸出
阿新 • • 發佈:2021-02-14
from termcolor import colored
print(colored('text string','red'))
An example:
from termcolor import colored
import sys
print(colored('sys.path=','yellow'))
print(sys.path)
在termcolor的原始碼中,可以找到可用的顏色:
Available text colors: red, green, yellow, blue, magenta, cyan, white.
在使用termcolor之前,需要使用pip安裝termcolor
pip install termcolor