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)
posted @ 2020-06-13 10:48  龚政  阅读(937)  评论(0编辑  收藏  举报