sorry,my poor english.
I got a solution  from others.
I must use utf-8 for chinese.


>>> import sys
>>> reload(sys)
>>> sys.setdefaultencoding("utf-8")
>>> s='\xe9\xab\x98' #this uff-8 string
>>> ss=U'\xe9\xab\x98'
>>> ss1=ss.encode('unicode_escape').decode('string_escape')
>>> s1=s.decode('unicode_escape')
>>> s1==ss
True
>>> ss1==s
True
>>>

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to