How do I print colored output to the terminal in Python?

前端 未结 7 1065
日久生厌
日久生厌 2020-12-04 17:55

Is there any python equivalent for perl\'s

print color \'red\';
print ;
print color \'reset\';

available in python?

<
7条回答
  •  没有蜡笔的小新
    2020-12-04 18:05

    A side note: Windows users should run os.system('color') first, otherwise you would see some ANSI escape sequences rather than a colored output.

提交回复
热议问题