美文网首页
python print显示颜色格式

python print显示颜色格式

作者: oopp8 | 来源:发表于2019-07-17 16:33 被阅读0次

显示颜色的格式:

\033[显示方式;字体色;背景色m ...... [\033[0m'

显示颜色的参数:

显示方式 效果
0 终端默认设置
1 高亮显示
4 使用下划线
5 闪烁
7 反白显示
8 不可见
字体色 背景色 颜色描述
30 40 黑色
31 41 红色
32 42 绿色
33 43 黄色
34 44 蓝色
35 45 紫红色
36 46 青蓝色
37 47 白色

例子

print('This is a \033[1;35m test\033[0m !')
print('This is a \033[1;32;43m test \033[0m !')
print('\033[1;33;44mThis is a test !\033[0m')
print('This is a \033[4;36;43m test \033[0m !')
image.png

相关文章

网友评论

      本文标题:python print显示颜色格式

      本文链接:https://www.haomeiwen.com/subject/ofcclctx.html