Created
March 11, 2017 18:12
-
-
Save mingyuan-xia/f624c4102e5dd30517b0f2ac6e0d03cf to your computer and use it in GitHub Desktop.
Make Python terminal output colorful
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| 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' | |
| def print_warning(msg): | |
| print(bcolors.WARNING + str(msg) + bcolors.ENDC) | |
| def print_err(msg): | |
| print(bcolors.FAIL + str(msg) + bcolors.ENDC) | |
| def print_info(msg): | |
| print(str(msg)) | |
| def print_emph(msg): | |
| print(bcolors.OKGREEN + str(msg) + bcolors.ENDC) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment