简体   繁体   中英

coloring text not working in Jupyter notebook

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")

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>')))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM