我正在使用一个第三方API,它将数据作为Python CSV读取器对象返回。你知道吗
响应CSV读取器对象如下所示:
dir(data)
Out[67]:
['__class__',
'__delattr__',
'__doc__',
'__format__',
'__getattribute__',
'__hash__',
'__init__',
'__iter__',
'__new__',
'__reduce__',
'__reduce_ex__',
'__repr__',
'__setattr__',
'__sizeof__',
'__str__',
'__subclasshook__',
'dialect',
'line_num',
'next']
type(data)
Out[68]: _csv.reader
当我尝试读取此对象时,出现以下错误:
l = list(data)
Traceback (most recent call last):
File "<ipython-input-69-587d9010ea41>", line 1, in <module>
l = list(data)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2013' in position 88: ordinal not in range(128)
这是我能从我这边解决的问题还是我必须让供应商来解决?你知道吗
谢谢你!你知道吗
你试过python3.4吗?这也许能解决问题。你知道吗
相关问题 更多 >
编程相关推荐