Thursday, March 14, 2013

[ Level 1 ] How ansi color in terminal by Python script.

Sample for show ansi color in terminal by Python script.
#!/bin/env python
import os
print os.popen('echo "\033[31m\033[43mHello World!\033[0m"').read()
print '\033[31m\033[43m' + 'Hello World!' + '\033[0m'

Wish this helps.

regards,
Stanley Huang