Python3通过excel向Sqlite3写入数据

1、安装python3和sqlite3,并配置环境变量

https://www.runoob.com/sqlite/sqlite-installation.html

https://www.runoob.com/python/python-install.html

https://www.jb51.net/os/MAC/432557.html

2、先下载各种类库

    pip3 install pysqlite3 等,其中xlrd需要用1.2.0版本,新版不支持xlsx,pip3 install xlrd==1.2.0

    pip3 list 查看package列表,含版本信息

3、写Python

    ① 注意MySQL和Sqlite3有区别

    ② 注意""

    ③ 注意tab缩进

    ④ 时间函数传参不能为空,判空:

        if row_list[6] is not None or row_list[6]!='':

            scbm_date_tmp = datetime(*xldate_as_tuple(row_list[6], 0))

    ⑤ 浮点数判空:https://blog.csdn.net/yuanxiang01/article/details/79419566

    ⑥ 注意局部变量和全局变量

4、打包 —— https://www.jianshu.com/p/75da02dfa1a3 

注:按上述链接可能遇到Py2app: Operation not permitted,改为python3 setup.py py2app

a = NaNprint type(a) # 打印输出NaN的类型print math.isnan(a)

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容