2

This code works in the Anaconda Prompt but in the jupyter notebook it prints normal text.

from colorama import init, Fore, Back, Style
init(convert=True)
print (Fore.RED + "My Text is Red")
zxcv
  • 23
  • 3
  • from https://pypi.org/project/colorama/ : Makes ANSI escape character sequences (for producing colored terminal text and cursor positioning) work under MS Windows. meaning that depending on the editor it may get rid of those ansi escape characters automatically since it is meant for terminal – Matiiss Jul 17 '21 at 17:51

1 Answers1

1

Try following code that mod from this post.

from IPython.display import Markdown, display
import HTML

tags = ['<div>','<body>','<h1>']
for tag in tags:    
    tag = html.escape(tag)
    display(Markdown((f'this is your tag: <text style=color:green>{tag}</text>')))
J. S. Lin
  • 26
  • 2