列出指定目录下的全部文件
import os
file_array=[]
dir_array=[
os.getcwd() + "/directory1/",
os.getcwd() + "/directory2/",
]
for dir in dir_array:
for root, dirs, files in os.walk(dir):
for filename in files:
file_array.append(dir+filename)
Excel操作读写
wb = xlrd.open_workbook(filepath)
sh = wb.sheet_by_name('数据明细')
# print(sh.nrows) # 有效数据行数
# print(sh.ncols) # 有效数据列数
for index in range(len(sh.row_values(0))):
title = sh.row_values(0)[index]