On Aug 12, 2007, at 7:05 PM, Rohan wrote:
> Can some one tell me how do I get colored text. Say when I want to
> write something in a text file , how do I get it colored.

You can use ANSI escape codes -- http://en.wikipedia.org/wiki/ 
ANSI_escape_code:

colorCodes = [
     "\033[0mAll attributes off\033[0m",
     "\033[1mBold\033[0m",
     "\033[4mUnderline\033[0m",
     "\033[5mBlink\033[0m",
     "\033[8mHide\033[0m",
     "\033[30mBlack\033[0m",
     "\033[31mRed\033[0m",
     "\033[32mGreen\033[0m",
     "\033[33mYellow\033[0m",
     "\033[34mBlue\033[0m",
     "\033[35mMagenta\033[0m",
     "\033[36mCyan\033[0m",
     "\033[37mWhite\033[0m",
     "\033[40m\033[37mBlack Background\033[0m",
     "\033[41mRed Background\033[0m",
     "\033[42mGreen Background\033[0m",
     "\033[43mYellow Background\033[0m",
     "\033[44mBlue Background\033[0m",
     "\033[45mMagenta Background\033[0m",
     "\033[46mCyan Background\033[0m",
     "\033[47mWhite Background\033[0m"
]

for i in colorCodes:
     print i

hth,
Michael
---
"I would rather use Java than Perl. And I'd rather be eaten by a  
crocodile than use Java." — Trouser


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to