python彩色打印
colorprint.py
"""
coding:utf-8
@Software:PyCharm
@Time:7/12/22 9:38 PM
@Author:zhanghc
"""def color_print(val,style=0,font=0,back=0):print(str("\033[{0};{1};{2}m" + val + '\033[0m').format(style, font, back))def debug(val):color_print(val, 0, 35, 47)
def error(var):color_print(var, 0, 31, 47)
def warning(var):color_print(var, 0, 33, 47)
def info(var):color_print(var, 0, 32, 47)
main.py
import colorprintcolorprint.debug('debug')
colorprint.info('info')
colorprint.warning('warning')
colorprint.error('error')