foxpro dbf fi中删除记录的处理问题

2024-09-27 23:22:35 发布

您现在位置:Python中文网/ 问答频道 /正文

我总是得到以下信息:

is_deleted() is not defined

这是我的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()

Tags: inimport程序信息forifistable
1条回答
网友
1楼 · 发布于 2024-09-27 23:22:35

来自phyton dbf包的文档(参见enter link description here:)

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()

相关问题 更多 >

    热门问题