python查看dbf编码_python语言读写dbf文件,中文编码的问题

第一次在segmentfault发帖,也是没办法,才希望能够得到帮助。

问题也许很低端,但是,我尝试了一个礼拜了,都没有找到好的解决方法。。。请各位大神帮帮忙

问题描述

希望做到用python来输出一份dbf格式的文件。

于是乎,我百度到了这一份python2的代码,可以工作

#!/usr/bin/python

# -*- coding: utf-8 -*-

import struct

import datetime

import decimal

import itertools

def dbfwriter(f, fieldnames, fieldspecs, records):

""" Return a string suitable for writing directly to a binary dbf file.

File f should be open for writing in a binary mode.

Fieldnames should be no longer than ten characters and not include \x00.

Fieldspecs are in the form (type, size, deci) where

type is one of:

C for ascii character data

M for ascii character memo data (real memo fields not supported)

D for datetime objects

N for ints or decimal objects

L for logic

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值