版权声明:小妖666个人笔记 https://blog.csdn.net/weixin_38883338/article/details/88959644
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)