python dbf struct.error:解包需要长度为4的字符串参数
我有一个程序,可以检测dbf文件中的更改并将其上载到mysql数据库。一直工作到今天python dbf struct.error:解包需要长度为4的字符串参数,python,Python,我有一个程序,可以检测dbf文件中的更改并将其上载到mysql数据库。一直工作到今天 Getting struct.error: unpack requires a string argument of length 4 我已经对代码进行了条带化,只是为了迭代dbf文件,但仍然会出现相同的错误 import dbf source_path = "/path/to/file" file_name = "/file.dbf" source = dbf.Table(source_path +
Getting struct.error: unpack requires a string argument of length 4
我已经对代码进行了条带化,只是为了迭代dbf文件,但仍然会出现相同的错误
import dbf
source_path = "/path/to/file"
file_name = "/file.dbf"
source = dbf.Table(source_path + file_name)
source.open()
for row in source:
print row
旁注,使用
(源路径,文件名)
而不是字符串连接更为稳健。旁注,使用(源路径,文件名)
而不是字符串连接更为稳健。