Print in Terminal with Colors using Python

terminalColorWithPython

#!/usr/bin/python

Color={
        'black'     : "\033[90m",
        'red'       : "\033[91m",
        'green'     : "\033[92m",
        'yellow'    : "\033[93m",
        'blue'      : "\033[94m",
        'magenta'   : "\033[95m",
        'cyan'      : "\033[96m",
        'white'     : "\033[97m",
        'default'   : "\033[99m",
      }

for color in Color:
    print Color[color] + color

References :
[1] Python output complex line with floats colored by value, stackoverflow, http://stackoverflow.com/questions/15580303/python-output-complex-line-with-floats-colored-by-value?answertab=oldest#tab-top
[2] Print in terminal with colors using Python?, stackoverflow, http://stackoverflow.com/questions/287871/print-in-terminal-with-colors-using-python

Advertisements
Tagged with: , , , , , , , , , , , ,
Posted in 2) Computer Engineering

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Recent Posts
누적 방문자 수
  • 146,251 hits
%d bloggers like this: