用xlrd读取excel表格(python)
来源:互联网 发布:淘宝宝贝优化到首页 编辑:程序博客网 时间:2024/06/04 18:16
def data(excelPath, sheetName): data = xlrd.open_workbook(excelPath) table = data.sheet_by_name(sheetName) # 获取第一行作为key值 keys = table.row_values(0) # 获取总行数 rowNum = table.nrows # 获取总列数 colNum = table.ncols if rowNum <= 1: raise BaseException("测试数据异常") else: r = [] j = 1 for i in range(rowNum - 1): s = {} # 从第二行取对应values值 values = table.row_values(j) for x in range(colNum): s[keys[x]] = values[x] r.append(s) j += 1 return r
阅读全文
0 0
- 用xlrd读取excel表格(python)
- python的xlrd模块(读取excel表格)
- Python读取excel表格操作之xlrd
- python读取excel表格——xlrd的使用
- Python读取excel文件(xlrd,xlwt)
- Python与Excel之一 xlrd读取excel
- xlrd-使用python处理Excel表格
- python操作excel表格(xlrd/xlwt)
- python操作excel表格(xlrd/xlwt)
- 用python读写excel(xlrd、xlwt)
- 用python读写excel(xlrd、xlwt)
- 用python处理Excel文档(1)——用xlrd模块读取xls/xlsx文档
- Python 使用 xlrd 读取 Excel格式文件
- Python 使用 xlrd 读取 Excel格式文件
- Python 使用 xlrd 读取 Excel格式文件
- Python 使用xlrd库读取excel
- python读取excel文件—xlrd
- Python xlrd读取excel异常处理
- fabric 关于追加新组织结构
- eclipse+adt+android sdk搭建框架appium
- vue.js全局API之nextTick
- 城市三级联动功能实现
- Shell脚本下的彩色进度条
- 用xlrd读取excel表格(python)
- Python之print语句
- Shader Forge界面功能简介
- Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK fla
- AI俗语
- BZOJ 2463 谁能赢呢?
- pythonsql语句
- 新手若这样学SEO,一百小时轻松脱胎换骨
- 第一次接触tensorflow