2011/10/22

Python: print color text for terminal

import sys

sys.stdout.write("\x1b[1;31mSample" + "\x1b[0;32m Test")
sys.stdout.write("\x1b[0m")