Joining Strings
Jussi Piitulainen
jussi.piitulainen at helsinki.fi
Fri Apr 8 01:02:36 EDT 2016
Emeka writes:
> Thanks it worked when parsed with json.load. However, it needed this
> decode('utf'):
>
> data = json.loads(respData.decode('utf-8'))
So it does. The response data is bytes.
There's also a way to wrap a decoding reader between the response object
and the JSON parser (json.load instead of json.loads):
response = urllib.request.urlopen(command) # a stream of bytes ...
please = codecs.getreader('UTF-8') # ... to characters
result = json.load(please(response))
More information about the Python-list
mailing list