我有大量的DBASE IV.dbf文件,我希望能够在python3中读取这些文件。它们是每天生成的,我正在寻找一种在AWS Lambda中处理它们的方法,因此使用python脚本。dbfread是我尝试过的解决方案之一。很遗憾,我无法从文件中读取数据,因为我遇到以下错误:
File "C:\Users\sa\AppData\Local\Continuum\anaconda3\lib\site-packages\dbfread\dbf.py", line 122, in __init__
self._read_field_headers(infile)
File "C:\Users\sa\AppData\Local\Continuum\anaconda3\lib\site-packages\dbfread\dbf.py", line 224, in _read_field_headers
field = DBFField.unpack(sep + infile.read(DBFField.size - 1))
File "C:\Users\sa\AppData\Local\Continuum\anaconda3\lib\site-packages\dbfread\struct_parser.py", line 36, in unpack
items = zip(self.names, self.struct.unpack(data))
error: unpack requires a buffer of 32 bytes
我尝试过使用dbfread模块、dbfpy、tablib和其他一些没有乐趣的模块。你知道吗
def printdbfread(filename):
table = DBF(filename, encoding='iso-8859-1')
#table = DBF(filename, parserclass=TestFieldParser)
for record in table:
print(record)
任何上述方面的帮助或任何指向其他模块的指针都将不胜感激,这些模块可能会读取有问题的文件。你知道吗
目前没有回答
相关问题 更多 >
编程相关推荐