1
Yo_oY OP 自己找到了,XD
Via: http://hi.baidu.com/kanif/item/398612af052770ad29ce9d99 def ustr2unicode(input): end = len(input) pos = 0 output = u"" while pos < end: if pos <= end - 6 and input[pos] == '\\' and input[pos+1] == 'u': output += unichr(int(input[pos+2:pos+6], 16)) pos = pos + 6 else: output += unicode(input[pos]) pos += 1 return output |
2
reorx 2013-02-25 21:39:28 +08:00 1
print b.decode('unicode_escape')
see: [1] http://stackoverflow.com/questions/267436/how-do-i-treat-an-ascii-string-as-unicode-and-unescape-the-escaped-characters-in [2] http://docs.python.org/2/library/codecs.html#standard-encodings (search for "unicode_escape" and "raw_unicode_escape") |
3
lianghai 2013-02-25 23:18:50 +08:00
给一楼跪……
|
6
swulling 2013-02-26 01:29:02 +08:00
lz一般是要解析js中的unicode吧。。。
|