问题
I need a python module that prints a colored output text for input() and print() functions which works on idle, Powershell, and Linux consols.
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.
回答1:
You can use 'clrprint' module which works for idle, terminal and PowerShell too
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()
Take a look at https://github.com/AbhijithAJ/clrprint for more info and screenshots.
来源:https://stackoverflow.com/questions/62933340/is-there-a-single-python-module-for-colored-text-output-in-idle-powershell-and