0

I am just getting started with Python. I have an error string that I want to stood out, currently it is just a basic text like the one you read right now.

   error = future.exception() is not None
        string = f'{getTimestamp()}: The "{future.tag}" task '
        string += f'failed: "{future.exception()}"\n' if error else 'was completed.\n'

How would it be the best way that string to be displayed in color red?

ddevelp
  • 19
  • 2

1 Answers1

1

try this using plain python(ANSI codes)

string='your string'
print(f'\033[91m{string}\033[0m')

using colorama

from colorama import Fore, Style
string="your string"
print(Fore.RED + string)
print(Style.RESET_ALL)

i think this works.

ItsMe
  • 395
  • 2
  • 13