Python读excel
来源:互联网 发布:学淘宝开店的书籍 编辑:程序博客网 时间:2024/06/06 16:55
需求:
取excel中数据生成用于插入数据库的SQL语句(当然也可以直接插入到数据库)。
步骤:
①安装xlrd,下载xlrd 解压,python setup.py install 安装
②编码
import xlrdbook = xlrd.open_workbook("d:/excel.xls")sh = book.sheet_by_index(0)for rx in range(sh.nrows): rowdata = sh.row_values(rx) name = rowdata[0] sex = rowdata[1] age = rowdata[2] sql = "insert into tbName (name, sex, age) values ('"+name+"','"+sex+"','"+unicode(age)+"');" print sql
- Python 读Excel
- python读excel示例
- Python读excel
- python读excel
- Python 读Excel文件
- python excel
- Python Excel
- Python & Excel
- Python------Excel
- 【Python】Python处理Excel
- 【python】python读写excel
- python用xlrd读excel文件
- Python数据处理Excel xlwt-写 xlrd-读
- python实现读Excel写入.txt
- python读excel两种方式
- Flask Excel python操作excel
- 【Python】Python读取Excel单元格
- 使用python操作excel
- 比喻
- 一些开源库和开源项目..留个笔记...(转别人的博客)
- iOS程序自动检测更新的实现
- java第十八天_IO流1
- 流媒体编码参数确定办法
- Python读excel
- ubuntu下android源码编译流程
- Java 7 的新特性
- 网络版俄罗斯方块实验
- 公司办公网络arp木马防治方案20120519
- 视频编码的常见参数基本概念
- 时间转化成数字
- Socket编程指南及示例程序
- PDFiend