0

I am trying to print a text in a different color. I have already installed termcolor, but when type:

from termcolor import colored
print(colored("hello","blue"))

it appears

[34mhello[0m .
Trenton McKinney
  • 43,885
  • 25
  • 111
  • 113
Gon
  • 123
  • 5

2 Answers2

0

You can use this code in IPython like Jupyter Notebook OR google colab

!pip install termcolor
from termcolor import colored
print(colored("hello","blue"))
I'mahdi
  • 11,310
  • 3
  • 17
  • 23
0

First of all: pip install colorama
And seconds:

from colorama import Fore, Back, Style
print(Fore.GREEN + Back.RED + Style.DIM + "hello world")

(This is an example, whole pip package usage * description click here)
For some unknown reason for me when I open CMD & try it doesn't work BUT when I code in VSCode & run from there with terminal window as CMD it works fine.

barakadax
  • 37
  • 8