python 控制台 颜色输入 和 输出

python 改变控制台的输入和输出字体的颜色

  1. 第一步是安装包 pip install colorama

  2. 第二步 使用

from colorama import init, Fore
init(autoreset=True)
# 通过使用autoreset参数可以让变色效果只对当前输出起作用,输出完成后颜色恢复默认设置
print(Fore.RED + 'welcome to www.jb51.net')
print('automatically back to default color again')
a = input(Fore.GREEN)
原文地址:https://www.cnblogs.com/gznb/p/13112016.html