Skip to content

Instantly share code, notes, and snippets.

@rfong
Created October 29, 2015 10:04
Show Gist options
  • Save rfong/fdd58f639870b8fcaf56 to your computer and use it in GitHub Desktop.
Save rfong/fdd58f639870b8fcaf56 to your computer and use it in GitHub Desktop.
colorfulprint
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