string processing question

Paul McGuire ptmcg at austin.rr.com
Thu Apr 30 19:32:59 CEST 2009


On Apr 30, 11:55 am, Kurt Mueller <m... at problemlos.ch> wrote:
> Hi,
>
> on a Linux system and python 2.5.1 I have the
> following behaviour which I do not understand:
>
> case 1> python -c 'a="ä"; print a ; print a.center(6,"-") ; b=unicode(a, "utf8"); print b.center(6,"-")'
>
> ä
> --ä--
> --ä---
>
>

Weird.  What happens if you change the second print statement to:

print b.center(6,u"-")

-- Paul



More information about the Python-list mailing list