python2.7脚本不再在cons中显示颜色

2024-09-28 03:24:09 发布

您现在位置:Python中文网/ 问答频道 /正文

昨天还在工作,我什么都没变

这就是以前的工作:

def printOutput(col,ostr):
    HEADER = '\033[95m'
    BLUE = '\033[94m'
    GREEN = '\033[92m'
    RED = '\033[91m'
    YELLOW = '\033[93m'
    ENDC = '\033[0m'
    ostr = str(ostr)
    if(col=='RED'):
          print(RED + ostr + ENDC)
    elif(col=='GREEN'):
      print(GREEN + ostr + ENDC)
    elif(col=='BLUE'):
          print(BLUE + ostr + ENDC)
    elif(col=='YELLOW'):
          print(YELLOW + ostr + ENDC)
    else:
          print(ostr)

Tags: ifdefcolgreenblueredelseheader

热门问题