how to make format operator % work with unicode as expected

Peter Pei yantao at telus.com
Sun Jan 27 00:48:48 EST 2008


For sure I can calculate the number of characters and do the padding myself, 
but what's the point, and i surely hope that python does it for me.
============
"Peter Pei" <yantao at telus.com> wrote in message 
news:cjTmj.43610$fj2.37903 at edtnps82...
>I am using things like "%-20s%-60s%-10s" in tkinter listbox to make it look 
>like a table, with mono sized font like lucie system. But this does not 
>work with data contains "Les misérables", because it is unicode, and one 
>byte is not neccessary one character. Now how can I resolve this issue?
>
> My issue is "how to make format operator % work with unicode as expected", 
> and has nothing to do with tkinter. If I want to use a table widget or 
> something, I can. But that's not the question. 




More information about the Python-list mailing list