[Python] ANSI escape sequence "\033[1m" printing bold for rest of program instead of specified...

Discussão em 'Python' iniciado por Stack, Abril 12, 2025.

  1. Stack

    Stack Membro Participativo

    I'm using the ANSI escape sequence for bold text;"\033[1m" in a print statement to create a bold header for my Python project. The problem is once I write a line like this: print("\033[1m"+"title"), any normal print statement I write afterword returns in bold as well. How can I make just one specified line bold instead of everything? Code:

    print("\033[1m"+"Title")
    print("Why is this text in bold as well?")

    Continue reading...

Compartilhe esta Página