Colorize expanded tabs
qwweeeit at yahoo.it
Sun Dec 4 11:58:40 CET 2005
from a string embedding tabs I want to colorize them when expanded:
# Starting from a string:
# which embeds both tabs and lfs
# printing it you obtain:
# 1234 5678 90
# print automatically expands tabs and interprets the NL.
# to colorize the expanded tabs, I tried:
print a.replace('\t',"\033[41m\t\033[0m") # 41 = red color
# instead it works (in Linux) for the \n (substituted with a red
print a.replace('\n',"\033[41m \033[0m\n")
Can you help me?
More information about the Python-list