繁体   English   中英

着色文本在 Jupyter 笔记本中不起作用

[英]coloring text not working in Jupyter notebook

此代码在 Anaconda 提示符中有效,但在 jupyter 笔记本中它打印普通文本。

from colorama import init, Fore, Back, Style
init(convert=True)
print (Fore.RED + "My Text is Red")

尝试遵循这篇文章中的 mod 代码。

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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