Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Read DBF Files with Python

Project Description

DBF is a file format used by databases such dBase, Visual FoxPro, and FoxBase+. This library reads DBF files and returns the data as native Python data types for further processing. It is primarily intended for batch jobs and one-off scripts.

>>> from dbfread import DBF
>>> for record in DBF('people.dbf'):
...     print(record)
OrderedDict([('NAME', 'Alice'), ('BIRTHDATE',, 3, 1))])
OrderedDict([('NAME', 'Bob'), ('BIRTHDATE',, 11, 12))])

By default records are streamed directly from the file. If you have enough memory you can instead load them into a list. This allows for random access:

>>> table = DBF('people.dbf', load=True)
>>> print(table.records[1]['NAME'])
>>> print(table.records[0]['NAME'])

Full documentation at

See docs/changes.rst for a full list of changes in each version.

Main Features

  • written for Python 3, but also works in 2.7
  • simple but flexible API
  • data is returned as native Python data types
  • records are ordered dictionaries, but can be reconfigured to be of any type
  • aims to handle all variants of DBF files. (Currently only widely tested with Visual FoxPro, but should work well with other variants.)
  • support for 18 field types. Custom types can be added by subclassing FieldParser
  • reads FPT and DBT memo files, both text and binary data
  • handles mixed case file names gracefully on case sensitive file systems
  • can retrieve deleted records


Requires Python 3.2 or 2.7.

pip install dbfread

dbfread is a pure Python module and doesn’t depend on any packages outside the standard library.

To build documentation locally:

python docs

This requires Sphinx. The resulting files can be found in docs/_build/.

Source code

Latest stable release:

Development version:

API Changes and are deprecated as of version 2.0, and will be removed in 2.2.

The DBF class is no longer a subclass of list. This makes the API a lot cleaner and easier to understand, but old code that relied on this behaviour will be broken. Iteration and record counting works the same as before. Other list operations can be rewritten using the record attribute. For example:

table ='people.dbf')

can be rewritten as:

table = DBF('people.dbf', load=True)

open() and read() both return DeprecatedDBF, which is a subclass of DBF and list and thus backward compatible.


dbfread is released under the terms of the MIT license.


Ole Martin Bjorndalen -

Release History

Release History

This version
History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
dbfread-2.0.7-py2.py3-none-any.whl (20.0 kB) Copy SHA256 Checksum SHA256 2.7 Wheel Nov 25, 2016
dbfread-2.0.7.tar.gz (33.2 kB) Copy SHA256 Checksum SHA256 Source Nov 25, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting