sam
sam

Reputation: 19204

changing font\color in python file using python script

I have a python file names test.py which containes python code.

print "THIS IS TEST"
print "THIS IS GOOD"
print "THIS IS BAD"

I want to change the font\color or background of the line in any editor

print "THIS IS GOOD"

How can I do that?

If its editors specific, which editor will allow me to do such changes in file itself using code? IDLE, Eclipse, Notepad++ or any else?

Please let me know any editor and its scripting example by which I can view such changed file with changed line in it.

I DO NOT WISH TO PRINT IN TERMINAL. I NEED TO HIGHLIGHT LINE/CHANGE FONT IN ECLIPSE, NOTEPAD++ OR IDLE.

Upvotes: 0

Views: 2988

Answers (1)

PaleNeutron
PaleNeutron

Reputation: 3235

Print in terminal with colors using Python?

This question will help.

An example:

print '\033[94m'+"THIS IS GOOD"+'\033[0m'

Since you referenced "notepad++", I guess you work on windows. So, try this:

Change shell print color in python 3.3.2

from subprocess import call

call('color a', shell=True) #this sets the color to light green
print('The quick brown fox jumps over the lazy dog.')

Upvotes: 1

Related Questions