1000字范文,内容丰富有趣,学习的好帮手!
1000字范文 > python dbf转excel 使用Python将.csv文件转换为.dbf?

python dbf转excel 使用Python将.csv文件转换为.dbf?

时间:2023-04-30 19:30:05

相关推荐

python dbf转excel 使用Python将.csv文件转换为.dbf?

How can I convert a .csv file into .dbf file using a python script? I found this piece of code online but I'm not certain how reliable it is. Are there any modules out there that have this functionality?

解决方案

You won't find anything on the net that reads a CSV file and writes a DBF file such that you can just invoke it and supply 2 file-paths. For each DBF field you need to specify the type, size, and (if relevant) number of decimal places.

Some questions:

What software is going to consume the output DBF file?

There is no such thing as "the" (one and only) DBF file format. Do you need dBase III ? dBase 4? 7? Visual FoxPro? etc?

What is the maximum length of text field that you need to write? Do you have non-ASCII text?

Which version of Python?

If your requirements are minimal (dBase III format, no non-ASCII text, text <= 254 bytes long, Python 2.X), then the cookbook recipe that you quoted should do the job.

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。