1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| import os import pandas as pd
path = r'地址'<!--more--> file_list = []
dfs = []
for root,dirs,files in os.walk(path): for file in files: file_path = os.path.join(root, file) file_list.append(file_path) df = pd.read_csv(file_path,encoding="gbk") dfs.append(df) df = pd.concat(dfs) df.to_excel(r'地址\汇总.xls', index=False)
|