import pandas as pd import time rootdir=r"G:\20220613库存\分类\\" rootexcel=r"G:\20220613库存\总表.xlsx" #获取所有sheet名 df0=pd.ExcelFile(rootexcel) sheet_list=df0.sheet_names print(df0.sheet_names) #循环写入新表 for sheetname in sheet_list: df1=pd.read_excel(rootexcel,sheet_name=sheetname) df1.to_excel(rootdir+sheetname+".xlsx") print(sheetname) print (time.perf_counter(),"秒(计算了sleep时间)") print (time.process_time(),"秒(不计算sleep时间)")
标签:sheet,Python,excel,sheetname,pd,time,print From: https://www.cnblogs.com/baiyidujiang/p/16744782.html