Python 3.4.0 (default, Mar 20 2014, 12:50:31) 
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

>>> b'\xe5\x93\x88\xe6\x96\xaf\xe6\x9c\x9d\xe9\xad\xaf'.decode('utf8')
'哈斯朝魯'

K

On Sunday, May 25, 2014 9:23:47 PM UTC-7, hito koto wrote:
>
> Hi,
>
> I7m try that's this time not the error but output the  
> ['\xe5\x93\x88\xe6\x96\xaf\xe6\x9c\x9d\xe9\xad\xaf']
>
>
>
>
>
>
> 2014年5月26日月曜日 13時15分41秒 UTC+9 WongoBongo:
>>
>> Try
>>
>> name = [name.encode("utf8") for name in Staff.objects.filter(id = 
>> 3).values_list('user_name', *flat=True*)]
>>
>> The other returns one-tuples in a list
>>
>> https://docs.djangoproject.com/en/dev/ref/models/querysets/#values-list
>>
>> K
>>
>> On Sunday, May 25, 2014 7:55:51 PM UTC-7, hito koto wrote:
>>>
>>> Hi,
>>> I want to encode in utf8 but don't know how can i to ?
>>>
>>> i have the errors is here:
>>>
>>> AttributeError: 'tuple' object has no attribute 'encode'
>>>
>>> My code is here :
>>>  name = [name.encode("utf8") for name in Staff.objects.filter(id = 
>>> 3).values_list('user_name')]
>>>
>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1f00a58a-7311-4e9c-a4c8-6ac0e266350b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to