Write a Python Program to Print Colored Text to the Terminal

Python Program to Print Colored Text to the Terminal

Welcome to the World of Online Learning:

Hello Friends “This blog helps you to learn  Python programming concepts. You can learn Python language at your own speed and time. One can learn concepts of Python language by practicing various programs given on various pages of this blog. Enjoy the power of Self-learning using the Internet.”

Python Program to Print Colored Text to the Terminal
Python Program to Print Colored Text to the Terminal

Write a Python Program to Print Colored Text to the Terminal

PROGRAM: Python Program to Print Colored Text to the Terminal

/* Python Program to Print Colored Text to the Terminal */

1: Using ANSI escape sequences

print(‘\x1b[38;2;5;86;243m’ + ‘Programiz’ + ‘\x1b[0m’)

OUTPUT :-

Programiz

2: Using python module termcolor

from termcolor import colored

print(colored(‘Programiz’, ‘blue’))

OUTPUT :-

Programiz

Leave a Reply

Your email address will not be published. Required fields are marked *