scripts use a public-domain Python module for reading
dBASE V files. See the Python Cheese
Shop page for more information about this module.
Here are links to the sources for the five modules in this package:
dbfpy package has no documentation; one
must read the code to learn how to use it. The package has
many more features we need, e.g., the ability to create new
databases and add records. We need only read-only access
Here is a brief summary of the basic features of the package. Import the package like this:
Dbf represents an entire
.dbf file. Its interface:
fileName, readOnly=False, new=False)
Name of the
.dbf file to be
If true, allows changes to the file.
If true, creates a new file with the given name.
Some relevant attributes of a
DbfHeader object containing
general information about the file; see Section 90.2, “
DbfHeader: Database header object”.
Number of records in the file.
List of field names, in record order.
DbfFieldDef objects that
define the columns of the database; see Section 90.3, “
DbfFieldDef: Field definition object”.
To retrieve a record from the file, you can use either
iteration or indexing. To iterate over the records in
for r in D: ...
This loop would set
r to each record in
turn. You can also ask for the
th record in the file by using the
With either method, the returned record is an instance of
DbfRecord; see Section 90.4, “
DbfRecord: Record object”.