Python之excel内容查找

#!/usr/bin/python3
# -*- coding: utf-8 -*-

import xlrd2

def search_excel(path,search_word):
    data_excel=xlrd2.open_workbook(path)
    for sh in data_excel.sheets():
        for row in sh.get_rows():
            for cell in row:
                if search_word in str(cell.value):
                    print(f"Found '{search_word}' at  行:'{cell.row}'  列:'{cell.column}'")



search_excel('C:/Users/2023/题库.xlsx','分析函数')

你可能感兴趣的:(Python,python,excel,开发语言)