[Python] Color a Text on the python shell

Discussão em 'Python' iniciado por Stack, Julho 9, 2025.

  1. Stack

    Stack Membro Participativo

    I've made several attempts.

    The first code I've tried is this one:

    import colorama
    from colorama import Fore

    print(Fore.RED + 'This text is red in color')


    but the output is not what I was expecting

    [​IMG]

    then I've tried this:

    import sys
    from termcolor import colored, cprint
    text = colored('Hello, World!', 'red', attrs=['reverse', 'blink'])
    print(text)


    but again the result is not correct

    [​IMG]

    is there a kind of a setting to setup in order to see the colored text or is it just a problem of python version? The version I'm using as shell is 3.10.4

    Continue reading...

Compartilhe esta Página