DBF转为CSV格式

#-*- coding : utf-8-*-
import csv
from dbfread import DBF
# 打开DBF文件并读取数据
table = DBF('D:\\0LW\DLTCQ\Point.dbf')

# 创建CSV文件并写入数据
with open('D:\\0LW\DLTCQ\Point1.csv', 'w', newline='') as csvfile:
    writer = csv.writer(csvfile)
    # 写入表头
    writer.writerow(table.field_names)
    # 写入每行数据
    for record in table:
        writer.writerow(list(record.values()))
print('处理结束')

你可能感兴趣的:(python,开发语言)