Created
October 29, 2015 10:04
-
-
Save rfong/fdd58f639870b8fcaf56 to your computer and use it in GitHub Desktop.
colorfulprint
This file contains 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
from cStringIO import StringIO | |
output = StringIO() | |
class bcolors: | |
HEADER = '\033[95m' | |
BLUE = '\033[94m' | |
GREEN = '\033[92m' | |
WARNING = '\033[93m' | |
FAIL = '\033[91m' | |
ENDC = '\033[0m' | |
BOLD = '\033[1m' | |
UNDERLINE = '\033[4m' | |
def cprint(msg, color=None): | |
global output | |
output.write(msg + '\n') | |
if color: | |
print color + msg + bcolors.ENDC | |
else: | |
print msg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment