how to make format operator % work with unicode as expected
Steven D'Aprano
steve at REMOVE-THIS-cybersource.com.au
Sun Jan 27 00:20:55 EST 2008
On Sun, 27 Jan 2008 04:06:45 +0000, Peter Pei wrote:
> I probably should mention that what I want is to make all parts of the
> string aligned, and look like table. I am not looking for other ways to
> make it table-alike, but only interested in making % work with unicode
> -counting characters not bytes...
% already works with unicode. Just give it unicode arguments:
>>> print u"x y z %s 1 2 3" % u"Les misérables"
x y z Les misérables 1 2 3
--
Steven
More information about the Python-list
mailing list