轻巧的dbf阅读器
dbf_light的Python项目详细描述
https://github.com/idlesign/dbf_light
说明
轻松的dbf阅读器
没有花哨的东西,只有最常见格式版本的dbf读取。
- Python2.7,3.4+;
- 使用namedtuple进行行表示和迭代行读取以最小化内存使用;
- 与西里尔语配合良好(支持kladr和cbrf数据库);
- 从zip文件中读取.dbf。
API
fromdbf_lightimportDbfwithDbf.open('some.dbf')asdbf:forfieldindbf.field:print('Field: %s'%field)print('Rows (%s):'%dbf.prolog.records_count)forrowindbf:print(row)# Read `some.dbf` from zip (ignoring filename case):withDbf.open_zip('some.dbf','here/myarch.zip',case_sensitive=False)asdbf:...
cli
需要单击软件包(可与pip install dbf_light[cli]一起安装)。
$ dbf_light describe myfile.dbf $ dbf_light show myfile.dbf