首页 > 解决方案 > 在 Windows 10 上的 Python 3.7 上使用 Colorama

问题描述

我试图让我的一部分代码使用 colorama 以彩色打印出来。我有:

from colorama import init, Fore, Style
init(convert=True)
print(Fore.RED + 'Hello')

但代码输出没有颜色变化。我究竟做错了什么?

标签: pythonpython-3.x

解决方案


它可以在没有 init(convert=True) 的情况下工作。你应该使用 init()

from colorama import init, Fore, Style
init()
print(Fore.RED + 'Hello')

推荐阅读