Subject: Escape sequences (colour) and padding with "%8s"%
> Hi all!
>
> I used escape sequences to produce colour output, but a construct like
>
> print "%8s" % str_with_escape
>
> doesn't do the right thing. I suppose the padding counts the esc
> If you insist on building the codes yourself instead of using the
> standard curses library...
>
> print '\x1b[34m%8s\x1b[0m' % 'TEST'
Will the curses library help? The problem is I need the colour coded in my
string and the "print pattern" is static.
What's the quickest way to solve this with
At Thursday 10/8/2006 07:04, Anton81 wrote:
For example:
print '%8s' % '\x1b[34mTEST\x1b[0m'
doesn't not indent 'TEST' whereas
print '%8s' % TEST'
works.
If you insist on building the codes yourself instead of using the
standard curses library...
print '\x1b[34m%8s\x1b[0m' % 'TEST'
G
For example:
print '%8s' % '\x1b[34mTEST\x1b[0m'
doesn't not indent 'TEST' whereas
print '%8s' % TEST'
works.
--
http://mail.python.org/mailman/listinfo/python-list
> I used escape sequences to produce colour output, but a construct like
>
> print "%8s" % str_with_escape
>
> doesn't do the right thing. I suppose the padding counts the escape
> characters, too.
>
> What could be a solution?
You omit half of the equation: the contents of str_with_escape.
Hi all!
I used escape sequences to produce colour output, but a construct like
print "%8s" % str_with_escape
doesn't do the right thing. I suppose the padding counts the escape
characters, too.
What could be a solution?
Anton
--
http://mail.python.org/mailman/listinfo/python-list