[Tutor] Problem using termcolor and colorama

Steven D'Aprano steve at pearwood.info
Thu Nov 15 12:10:00 EST 2018


On Thu, Nov 15, 2018 at 01:18:16PM +0000, John Blower wrote:
> I try to create colour text by using these two  modules , only returns the colour code, no colour text.
> How to solve this problem.

Use a terminal that supports colour codes.

 
> >>> import termcolor
> >>> import colorama
> >>> colorama.init()
> >>> termcolor.cprint('Hello World','red')
> [31mHello World[0m

What platform are you using?

What terminal are you using?

What terminals does termcolor support?

What does the documentation for termcolor say?



-- 
Steve


More information about the Tutor mailing list