gpt4 book ai didi

python - pyExcelerator 或 xlrd - 如何查找/搜索给定的几列数据的行?

转载 作者:太空宇宙 更新时间:2023-11-04 07:13:17 25 4
gpt4 key购买 nike

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

通过 Python 查找/搜索 Excel 行....任何想法,任何人?

最佳答案

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

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

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

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):

关于python - pyExcelerator 或 xlrd - 如何查找/搜索给定的几列数据的行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/778093/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com