0
点赞
收藏
分享

微信扫一扫

python print 彩色输出

木匠0819 2022-09-19 阅读 78


Update on 3-16, I find a more convienient packaged named ​​colorama​​​,
the more detailed usage please visit ​​​Python常用模块—— Colorama模块​​

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)

python print 彩色输出_print彩色

在termcolor的源码中,可以找到可用的颜色:

Available text colors:
red, green, yellow, blue, magenta, cyan, white.

在使用termcolor之前,需要使用pip安装termcolor

pip install


举报

相关推荐

0 条评论