微慑信息网

[python] 输出颜色 – colorama / termcolor

之前使用termcolor,最近看到有colorama,发现更加简单。。

1、termcolor

from termcolor import colored, cprint

str = colored(str(mTypeName), 'red','on_white',attrs=None)

 

2、colorama

from colorama import Fore,Back,Style,init

def main():
	#init(autoreset=True)
	print(Style.RESET_ALL)
	str = Fore.RED + " let me see see"
	print (str)
	print (Fore.WHITE +"let me see see")
if __name__ == '__main__':
	main()

 

 

 

 

拓展阅读(点评/知识):

Python基础教程 Colorama模块   https://zhuanlan.zhihu.com/p/76954975

本文标题:[python] 输出颜色 – colorama / termcolor
本文链接:
(转载请附上本文链接)
https://vulsee.com/archives/vulsee_2023/0911_16967.html
转载请附本站链接,未经允许不得转载,,谢谢:微慑信息网-VulSee.com » [python] 输出颜色 – colorama / termcolor
分享到: 更多 (0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

微慑信息网 专注工匠精神

访问我们联系我们