Python asking about changing color in the console

Question:
when i use python the console appears just in one color… how can i make it colorful when i get errors?
Thanks

Replit Profile: https://replit.com/@MolhamAlam

Hi @MolhamAlam , welcome to the forums!
I don’t think you can change the colour, but there is a workaround: to enclose your entire code in a try-except statement, and will print any error messages in red, using \033[31m:

try:
  #Your code here
except Exception as e:
  print(f'\033[31m{e}')

Hope this helps!

2 Likes

thank you … i will try that