Issue
I'm trying to highlight part of my output in the Windows console as follows:
print 'Matches:'+'\033[0;33m'+str(123)+'\033[0;0m'
It works fine in a Linux terminal, but under Windows it shows
>>>Matches:[0;33m123[0;0m
How can I enable highlighting in the Windows console?
PS: I think there should be a way to do this because it works with raw_input
. For example:
Solution
I have tried a method, mentioned by @eryksun, thanks for your help.
from IPython.utils.io import stdout;
stdout.write('Matches:'+'\033[0;33m'+str(123)+'\033[0;0m')
For further discussion, I find that even in pure python shell, the raw_input() works fine to highlight the text, but stdout.write is not working any more.
Here is the python shell output:
Answered By - Pythoner
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.