是否有单个python模块用于在闲置,Powershell和终端中输出彩色文本? [英] Is there a single python module for colored text output in idle, Powershell and terminal?

查看:39
本文介绍了是否有单个python模块用于在闲置,Powershell和终端中输出彩色文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一个python模块,该模块为input()和print()函数打印彩色输出文本,这些函数可在闲置,Powershell和Linux控制台上工作.

I need a python module that prints a colored output text for input() and print() functions which works on idle, Powershell, and Linux consols.

我只是期望几种颜色(不需要额外的背景功能),并且相同的功能应该在python空闲,PowerShell,终端和cmd上均能正常工作,并且具有完全的代码灵活性.

I am just expecting few colors (no extra background features required) and the same functions should work equally on python idle, PowerShell, terminal, and cmd with full flexibility of code.

推荐答案

您也可以使用'clrprint'模块,该模块也适用于空闲,终端和PowerShell

You can use 'clrprint' module which works for idle, terminal and PowerShell too

pip install clrprint

pip install clrprint

from clrprint import *
clrhelp() # print's available colors and usage

user_input = clrinput("input please: ",clr='r') # just like input() [color is red]
clrprint('your text',user_input,clr='green') # just like print() 

有关更多信息,请参见 https://github.com/AbhijithAJ/clrprint 屏幕截图.

Take a look at https://github.com/AbhijithAJ/clrprint for more info and screenshots.

这篇关于是否有单个python模块用于在闲置,Powershell和终端中输出彩色文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆