python查询文件夹下excel的sheet名代码实例
本文实例为大家分享了python查询文件夹下excel的sheet的具体代码,供大家参考,具体内容如下
import os,sys,stat,xlrd path=r"F:\360Downloads" sheet = input("sheet name:") def del_file(path): ls = os.listdir(path) for i in ls: c_path = os.path.join(path, i) if os.path.isdir(c_path): del_file(c_path) elif os.path.splitext(c_path)[1] == '.xlsx': workbook = xlrd.open_workbook(c_path) worksheets = workbook.sheet_names() if (u''+sheet in worksheets): print(c_path) print(worksheets) del_file(path)
以上所述是小编给大家介绍的python查询文件夹下excel的sheet名详解整合,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对安科网网站的支持!
相关推荐
diyanpython 2020-11-05
YENCSDN 2020-11-17
lsjweiyi 2020-11-17
houmenghu 2020-11-17
Erick 2020-11-17
HeyShHeyou 2020-11-17
以梦为马不负韶华 2020-10-20
lhtzbj 2020-11-17
夜斗不是神 2020-11-17
pythonjw 2020-11-17
dingwun 2020-11-16
lhxxhl 2020-11-16
坚持是一种品质 2020-11-16
染血白衣 2020-11-16
huavhuahua 2020-11-20
meylovezn 2020-11-20
逍遥友 2020-11-20