Example 1: Using ANSI escape sequences
print('\x1b[38;2;5;86;243m' + 'Programiz' + '\x1b[0m')
Example 2: Using python module termcolor
from termcolor import colored
print(colored('Programiz', 'blue'))
print('\x1b[38;2;5;86;243m' + 'Programiz' + '\x1b[0m')
Using decode() print(b'Easy \xE2\x9C\x85'.decode("utf-8"))
0 Comments