我正在学习python3的教程,但是我正在python2.7中工作,我如何为python2.7解码utf-8?
使用的代码是:
data = data.readall().decode("utf-8")但是我得到了一个AttributeError:
AttributeError: addinfourl instance has no attribute 'readall' 发布于 2015-07-17 03:36:18
我没有意识到在python3中字符串和字节之间存在差异,而在python2中没有这么大的差异。
以下代码适用于Python2: data = urllib2.urlopen(dataLink).read()
https://stackoverflow.com/questions/31462730
复制相似问题