0
import petl as etl
file_name = 'name of file'
file_in_memory = etl.fromcsv(file_name, encoding='utf-8')
print (etl.look(file_in_memory))
Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 13: ordinal not in range(128)
该文件包含导致错误的“20 Rue d'Estrées,75007 Paris,France”。在Python中使用petl模块加载utf-8文件时出错
我可以使用codes.open(file_name,mode ='r',encoding ='utf-8')读取文件,但希望能够使用petl库轻松操作csv。
有没有一种方法可以通过petl.fromcsv将其加载到内存中,同时保留字符?