Answers for "termcolor package in python"

2

termcolor python

# To install termcolor
pip install termcolor
Posted by: Guest on March-05-2021
1

python termcolor

import sys
from termcolor import colored, cprint

text = colored('Hello, World!', 'red', attrs=['reverse', 'blink'])
print(text)
cprint('Hello, World!', 'green', 'on_red')

print_red_on_cyan = lambda x: cprint(x, 'red', 'on_cyan')
print_red_on_cyan('Hello, World!')
print_red_on_cyan('Hello, Universe!')

for i in range(10):
    cprint(i, 'magenta', end=' ')

cprint("Attention!", 'red', attrs=['bold'], file=sys.stderr)
Posted by: Guest on May-07-2021

Python Answers by Framework

Browse Popular Code Answers by Language