0

Now I get some info via http request. But I find the String can not be parsed to the correct charset. This is my code:

req = urllib2.Request(URL, urllib.urlencode({"token": token}))
resp = urllib2.urlopen(req)
result = resp.read()
print result  #\u8c22\u777f
print repr(result ) #'\\u8c22\\u777f'

The correct string should be \u8c22\u777f, but the \u is escaped to \\u. What shall I do?

Anshul Goyal
  • 67,326
  • 35
  • 140
  • 172
xierui
  • 1,007
  • 8
  • 21

0 Answers0