1 #!/usr/bin/env python3 2 3 # -*- coding: UTF-8 -*- 4 5 import pandas as pd 6 import os 7 import re 8 9 if __name__ == '__main__':10 Folder_Path = '/root/XmlOut/'11 12 writer = pd.ExcelWriter('/root/out.xlsx')13 14 os.chdir(Folder_Path)15 file_list = os.listdir()16 17 for item in file_list:18 sheetname = item.split('_')[0]19 data = pd.read_table(Folder_Path+item, sep=',', encoding='GBK')20 data.to_excel(writer, sheetname, index=False)21 22 writer.save()