为简单起见,假设您当前的文件夹有一个名为的文件夹folder,所有这 15 个具有以下名称的 excel 文件file_1.xlsx, file_2.xlsx, ......, file_15.xlsx都位于该文件夹中。现在您可以使用glob来发现文件路径并pandas读取这些路径。将熊猫安装为pip install pandas xlrd.from glob import globimport pandas as pd# discover the path of all the xlsx filesfilenames = glob('folder/*.xlsx') 现在假设您要将列 'name, and server' 重命名为 'nameserver'for filename in filenames: # read each of the file df = pd.read_excel(filename) # rename the column name df = df.rename(columns={'name, and server': 'nameserver'}) # save the renamed files as csv df.to_csv(filename.split('.')[-2] + '.csv')