contro opinion wrote: > how can i get "你好" from '\xc4\xe3\xba\xc3' ?
>>> print '\xc4\xe3\xba\xc3'.decode("gbk")
你好
General rule: use the decode() method to convert from bytestring to unicode
and encode() to convert from unicode to bytestring.
bytestring.encode(x) will implicitly try
bytestring.decode("ascii").encode(x) which is likely to fail.
--
http://mail.python.org/mailman/listinfo/python-list
