python 设置Console下的文本样式

Console Make Text Color and Bold

来源地址:http://snipperize.todayclose.com/snippet/py/Console-Make-Text-Color-and-Bold--596002/

  
  
  
  
  1. def color(t, c): 
  2.         return chr(0x1b)+"["+str(c)+"m"+t+chr(0x1b)+"[0m" 
  3. def black(t): 
  4.         return color(t, 30
  5. def red(t): 
  6.         return color(t, 31
  7. def green(t): 
  8.         return color(t, 32
  9. def yellow(t): 
  10.         return color(t, 33
  11. def blue(t): 
  12.         return color(t, 34
  13. def mangenta(t): 
  14.         return color(t, 35
  15. def cyan(t): 
  16.         return color(t, 36
  17. def white(t): 
  18.         return color(t, 37
  19. def bold(t): 
  20.         return color(t, 1

 

你可能感兴趣的:(python,console,格式,文本,设置)