print显示设置

显示颜色格式:33[显示方式;字体色;背景色m......[33[0m]

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

例:

print('This is a 33[1;35m test 33[0m!')
print('This is a 33[1;32;43m test 33[0m!')
print('33[1;33;44mThis is a test !33[0m')

输出:

print输出时不换行:

如果 python是2.x版本,在语句后加一个英文的逗号 ,
print x,

如果 python是3.x 版本 print不换行参数 end=""
print(x, end="")

例:

print('he'
      ''   #中间回车键换行
      ''
      ''
      'llo jacky',end='')

输出:

hello jacky

  

原文地址:https://www.cnblogs.com/jacky-zhao/p/8119138.html