Convert Db3 File Csv

i' ve got al lot of csv file and would like to convert them to a dbf file.I found the code from Ethan Furman (see below)It works really good - thanks a lot - but my csv files have as the delimiter a semicolon. So with the code python puts all my data into one column, but I've got 5 columns.How can I change the delimiter?

here the link:Convert .csv file into .dbf using Python?


Using the dbf package you can get a basic csv file with code similar to this:

This will create table with the same name and either Character or Memo fields and field names of f0, f1, f2, etc.

For a different filename use the filename parameter, and if you know your field names you can also use the field_names parameter.

Rather basic documentation is available here.


1 Answer

Looking at the dbf code, I don't see any way to pass a dialect, so you may transform your files as follows:

Note: This will quote properly rows that already contain a comma as part of its contents.

Edit: If you're willing to patch dbf.from_csv to accept delimiter as a parameter to avoid transforming all your csv files, this should work:


Not the answer you're looking for? Browse other questions tagged pythoncsvdbf or ask your own question.