Python Petl - _csv.Error:行包含NULL字节

时间:2016-06-27 13:37:03

标签: python-2.7 csv petl

我正在运行:

table = petl.fromcsv('file.txt', delimiter = ',' , encoding = 'utf-8) 
petl.todb(table, connection, 'table') 

我在插入步骤中收到此错误:

File "/usr/local/lib/python2.7/dist-packages/petl/util/base.py", line 28, in __len__ 
 return sum(1 for _ in self) 
 File "/usr/local/lib/python2.7/dist-packages/petl/util/base.py", line 28, in <genexpr> 
 return sum(1 for _ in self) 
 File "/usr/local/lib/python2.7/dist-packages/petl/io/csv_py2.py", line 45, in __iter__ 
 for row in reader: 
 File "/usr/local/lib/python2.7/dist-packages/petl/io/csv_py2.py", line 149, in next 
 row = self.reader.next() 
_csv.Error: line contains NULL byte

我可以做些什么来解决这个问题?

0 个答案:

没有答案