pyExcelerator 或 xlrd - 如何为给定的几列数据查找/搜索一行? [英] pyExcelerator or xlrd - How to FIND/SEARCH a row for the given few column data?

查看:52
本文介绍了pyExcelerator 或 xlrd - 如何为给定的几列数据查找/搜索一行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Python 与 EXCEL 通信...我需要找到一种方法,以便我可以找到/搜索给定列数据的行.现在,我正在逐行扫描......这将很有用,如果有像 FIND/SEARCH/REPLACE 这样的功能......我在 pyExcelerator 或 xlrd 模块中没有看到这些功能......我不想使用 win32com模块!它使我的工具窗口基于!

Python communicating with EXCEL... i need to find a way so that I can find/search a row for given column datas. Now, i m scanning entire rows one by one... It would be useful, If there is some functions like FIND/SEARCH/REPLACE .... I dont see these features in pyExcelerator or xlrd modules.. I dont want to use win32com modules! it makes my tool windows based!

通过 Python 查找/搜索 Excel 行......有人知道吗?

FIND/SEARCH Excel rows through Python.... Any idea, anybody?

推荐答案

@John Fouhy:[我是 xlwt 的维护者,xlrd 的作者]

@John Fouhy: [I'm the maintainer of xlwt, and author of xlrd]

pyExcelerator 的电子表格阅读部分被严重弃用,以至于它完全从 xlwt 中消失了.要使用 Python 2.1+ 读取由 Excel 2.0 到 11.0 (Excel 2003) 或兼容软件创建的任何 XLS 文件,请使用 xlrd

The spreadsheet-reading part of pyExcelerator was so severely deprecated that it vanished completely out of xlwt. To read any XLS files created by Excel 2.0 up to 11.0 (Excel 2003) or compatible software, using Python 2.1+, use xlrd

xlrd 不需要简单优化 [sz]ation":

That "simple optimi[sz]ation" isn't needed with xlrd:

import xlrd
book = xlrd.open_workbook("foo.xls")
sheet = book.sheet_by_number(0) # alternatively: sheet_by_name("Budget")
for row_index in xrange(sheet.nrows): 
    for col_index in xrange(sheet.ncols):

这篇关于pyExcelerator 或 xlrd - 如何为给定的几列数据查找/搜索一行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆