[Tutor] i18n on Entry widgets
Kent Johnson
kent37 at tds.net
Thu Aug 18 01:19:36 CEST 2005
Jorge Louis de Castro wrote:
> Thanks again,
> Ok, it seems unpacking list items returns different types of string
> representations. Playing around on the interpreter this is what I found:
>
> lst = ['r', 'ent\xc3\xa3o?']
>
>>>> print lst[1]
>
> então?
>
>>>> s = lst[1]
>>>> print lst
>
> ['r', 'ent\xc3\xa3o?']
>
>>>> print s
>
> então?
>
>>>>
>
> So, the list has one thing inside but when I unpack it it comes out as
> something else.
It's the same string, just two different ways of looking at it. When you print lst, it prints repr(lst[1]) which shows non-ascii characters as \x escapes. When you print lst[1] it prints it as a string. Your console evidently doesn't handle utf-8; it prints two separate characters instead.
Kent
More information about the Tutor
mailing list