|  |  | 
 |  |  | import random | 
 |  |  | import shutil | 
 |  |  | import string | 
 |  |  | from datetime import datetime | 
 |  |  |  | 
 |  |  | from datetime import datetime | 
 |  |  | from openpyxl import load_workbook | 
 |  |  |  | 
 |  |  |  | 
 |  |  | 
 |  |  |         template_excel.save(output_path) | 
 |  |  |         template_excel.close() | 
 |  |  |  | 
 |  |  |         # 合并完成后删除无用文件 | 
 |  |  |         for filename in os.listdir(file_path): | 
 |  |  |             file_path_full = os.path.join(file_path, filename) | 
 |  |  |             try: | 
 |  |  |         try: | 
 |  |  |             for filename in os.listdir(file_path): | 
 |  |  |                 file_path_full = os.path.join(file_path, filename) | 
 |  |  |                 if os.path.isfile(file_path_full) or os.path.islink(file_path_full): | 
 |  |  |                     os.unlink(file_path_full) | 
 |  |  |                 elif os.path.isdir(file_path_full): | 
 |  |  |                     shutil.rmtree(file_path_full) | 
 |  |  |                 os.rmdir(file_path) | 
 |  |  |             except Exception as e: | 
 |  |  |                 print(f"删除文件时发生错误: {e}") | 
 |  |  |             os.rmdir(file_path) | 
 |  |  |         except Exception as e: | 
 |  |  |             print(f"删除文件时发生错误: {e}") | 
 |  |  |  | 
 |  |  |         return file_name | 
 |  |  |     except Exception as e: |