Python Tutorial
In python print statement, there is a provisioning to use colors, warning, failure and header indications.
OKGREEN = '\033[92m' OKBLUE = '\033[94m' ENDC = '\033[0m' BOLD = "\033[1m" HEADER = '\033[95m' WARNING = '\033[93m' FAIL = '\033[91m' print('\t' + OKGREEN + "Python printing in green color" + ENDC+'\n') print('\t' + OKBLUE + "Python printing in blue color" + ENDC +'\n') print('\t' + BOLD + "Python printing in bold" + ENDC+'\n') print('\t' + HEADER + "Python printing for header" + ENDC+'\n') print('\t' + WARNING + "Python printing for warning" + ENDC+'\n') print('\t' + FAIL + "Python printing for failure" + ENDC+'\n')
$ python color.py Python printing in green color Python printing in blue color Python printing in bold Python printing for header Python printing for warning Python printing for failure
Python program printing the lines in color is continue with the same color in next printing statement if ENDC '\033[0m' is not used in current printing statement.
OKBLUE = '\033[94m' ENDC = '\033[0m' BOLD = "\033[1m" print('\t' + OKBLUE + "Python printing in blue color" + '\n') print('\t' + BOLD + "Python printing in blue color and bold" + ENDC+'\n')
Python printing in blue color Python printing in blue color and bold
Python Tutorial
Privacy Policy | Copyright2020 - All Rights Reserved. | Contact us
| Report website issues in Github
| Facebook page
| Google+ page