python xlrd 使用
来源:互联网 发布:广东动易软件 编辑:程序博客网 时间:2024/05/20 12:51
1.获取单元格颜色
来自 stackoverflow
import xlrdbook = xlrd.open_workbook("sample.xls", formatting_info=True)sheets = book.sheet_names()print "sheets are:", sheetsfor index, sh in enumerate(sheets): sheet = book.sheet_by_index(index) print "Sheet:", sheet.name rows, cols = sheet.nrows, sheet.ncols print "Number of rows: %s Number of cols: %s" % (rows, cols) for row in range(rows): for col in range(cols): print "row, col is:", row+1, col+1, thecell = sheet.cell(row, col) # could get 'dump', 'value', 'xf_index' print thecell.value, xfx = sheet.cell_xf_index(row, col) xf = book.xf_list[xfx] bgx = xf.background.pattern_colour_index print bgx
在sheet类中,有一个对应的_cell_xf_indexes二维数组来存储每个单元格对应的样式序号。
同时,在book的xf_list存储着与样式序号所对应的具体样式信息。
0 0
- 【python】 xlrd的使用
- python xlrd 使用
- python xlrd 使用
- 【python】 xlrd的使用
- Python使用xlrd处理Excel
- python使用xlwt和xlrd
- Python 使用 xlrd 读取 Excel格式文件
- Python 使用 xlrd 读取 Excel格式文件
- Python 使用xlrd模块操作Excel写
- python操作Excel读写--使用xlrd
- python操作Excel读写--使用xlrd
- python操作Excel读写--使用xlrd
- python操作Excel读写--使用xlrd
- python操作Excel读写--使用xlrd
- python操作Excel读写--使用xlrd
- python操作Excel读写--使用xlrd
- python操作Excel读写--使用xlrd
- python操作Excel读写--使用xlrd
- eclipse 最佳配置
- 多线程之Executor框架
- bzoj 1079 题解
- watchify和browserify
- Android开发中在一个Activity中关闭另一个Activity
- python xlrd 使用
- Web App的零框架解决方案
- 好记性不如烂笔头26-JAVA处理文件事务(4)
- const的用法,特别是用在函数前面与后面的区别!
- webstorm、phpstorm、idea等使用技巧记录
- IOS学习 App Store审核指南中文版
- Ubuntu 下设置IP配置
- HTML5 学习----------视频操作
- Android SDK Manager国内无法更新的解决方案