为什么termcolor在Windows控制台中输出控制字符而不是彩色文本?

2024-05-19 08:11:06 发布

您现在位置:Python中文网/ 问答频道 /正文

我刚刚在Windows上安装了Python 2.7的termcolor。当我尝试打印彩色文本时,我得到的是彩色代码。

from termcolor import colored
print colored('Text text text', 'red')

结果如下:

Screenshot of the Windows console window with the line: "←31mText text text←[0m"

我在Far管理器上获得了相同的结果,当我尝试将脚本作为独立应用程序运行时。


Tags: 代码textfrom文本import脚本管理器windows

热门问题