I want to print a colored text in console. So I use this code provided here:
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
I'm hesitant about the way we can use this class. It has been said that:
To use code like this, you can do something like
print(bcolors.WARNING + "Warning: No active frommets remain. Continue?" + bcolors.ENDC)
or, with Python3.6+:
print(f"{bcolors.WARNING}Warning: No active frommets remain. Continue?{bcolors.ENDC}")
I'm using python 3.7, but both of these codes work for me, so I wanted to know how the usage is different based on Python version and what is that f
mentioned Python3.6+
part?