Skip to content

Instantly share code, notes, and snippets.

@fannheyward
Created December 7, 2013 12:06
Show Gist options
  • Save fannheyward/7840341 to your computer and use it in GitHub Desktop.
Save fannheyward/7840341 to your computer and use it in GitHub Desktop.
Python Unicode 编码反解,via http://www.v2ex.com/t/92197
Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> a = u'\xb2\xe2\xca\xd4'
>>> b = a.encode('raw_unicode_escape')
>>> print b
测试
>>> c = a.encode('latin1')
>>> print c
测试
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment