python - 在 Windows 10 上的 Python 3.7 上使用 Colorama
问题描述
我试图让我的一部分代码使用 colorama 以彩色打印出来。我有:
from colorama import init, Fore, Style
init(convert=True)
print(Fore.RED + 'Hello')
但代码输出没有颜色变化。我究竟做错了什么?
解决方案
它可以在没有 init(convert=True) 的情况下工作。你应该使用 init()
from colorama import init, Fore, Style
init()
print(Fore.RED + 'Hello')
推荐阅读
- spring-cloud - SimpleStorageResource 不支持 S3 的虚拟主机样式 url
- pytorch - Deeppavlov 将模型调整为拥抱脸模型
- c# - 从休息端点接收二进制数据
- r - 在传递因子标签时如何根据因子计算平均值?
- indexing - index Gridview 属性 onclic,按钮隐藏
- java - 此合并排序问题中的数组索引越界异常
- java - 如何使用 JDBC 将日期时间添加到我的 SQL 数据库中
- apache-kafka - 'confluent local services start' 返回一个非目录错误
- google-apps-script - 仅将包含 B 列中值的行复制到新工作表中
- java - 用户键入时打印到控制台