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

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to