python - 处理 foxpro dbf 文件中已删除记录的问题
问题描述
我总是收到以下消息:
is_deleted() 未定义
这是我的python程序。我究竟做错了什么?
import dbf
tableDirsync = dbf.Table("o:/python/dirsync.dbf")
tableDirsync.open()
for dirsync in tableDirsync:
if is_deleted(dirsync):
continue
else:
print(dirsync.diri1, dirsync.diro1)
tableDirsync.close()
mainloop()
解决方案
来自 phyton dbf 包的文档(请参阅在此处输入链接描述:)
Check if a record has been marked as deleted:
record = table[1] # for example
if record.has_been_deleted:
print "table.pack() will physically remove this record! (and all other deleted records)"
所以在你的情况下:
import dbf
tableDirsync = dbf.Table("o:/python/dirsync.dbf")
tableDirsync.open()
for dirsync in tableDirsync:
if dirsync.has_been_deleted:
continue
else:
print(dirsync.diri1, dirsync.diro1)
tableDirsync.close()
mainloop()
推荐阅读
- actions-on-google - 如何使用操作 sdk 在 webhook 中添加建议芯片
- python - sklearn.model_selection.train_test_split 随机状态
- php - 为什么函数参数不适用于类
- java - 完整的链表不会打印所有值
- ansible - Anisble Nmap 库存插件
- c# - 为什么不能通过继承 C# 中的类型来达到在接口中声明的嵌套类型?
- android - 如何绕过 Flutter InAppWebView 中的无效 SSL 证书
- pandas - Pandas Dataframe - 按列值分组并从其他列中查找值
- nativescript - 将填充的couchbase lite db保存为nativescript和vue中的备份?
- python - 在 Excel 的不同工作表中插入数据