How to print colored text in Python?


How can I output colored text in python?

1 Answer

4 years ago by

create a class for the colors you want

class colors:
    HEADER = '\033[95m'

To use code like this, you can do below

print(bcolors.HEADER + "Warning: Continue?")
4 years ago by Divya