【发布时间】:2014-09-26 11:49:20
【问题描述】:
我正在使用“termcolor”和“colored”在我的测试脚本中打印一些彩色单词。
>>> from termcolor import colored
>>> result = colored("pass", "red")
>>> print result
pass ----> ("appears in red")
>>> result = '\033[1m' + result + '\033[0m'
>>> print result
pass ------> ("appears in red and bold")
以上内容在 Mac 和 CentOS 上运行良好,但在 eclipse(在 CentOS 上)中无法以红色或粗体打印。它打印出类似“?[32mPASS?[0m””的东西——这没有多大帮助..
我想补充一点,上面的文本是在 eclipse 中打开的 XML 文件中看到的。编码格式可能在这里发挥作用。现在我在 XML 中看到“UTF-8”作为编码格式。
【问题讨论】:
标签: eclipse text colors centos format