From 1fac3ce2cf25958c77c2020e9958b721288e4d83 Mon Sep 17 00:00:00 2001 From: alantang <107459091+alantang1977@users.noreply.github.com> Date: Fri, 11 Apr 2025 14:19:40 +0800 Subject: [PATCH] Update app.py --- app.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app.py b/app.py index 0f0fcf0f..6490a2a1 100644 --- a/app.py +++ b/app.py @@ -159,10 +159,11 @@ def generate_txt_output(channels): def save_file(content, filename): """通用文件保存函数""" # 创建 live 文件夹,如果不存在 - if not os.path.exists('live'): - os.makedirs('live') + live_folder = 'live' + if not os.path.exists(live_folder): + os.makedirs(live_folder) + file_path = os.path.join(live_folder, filename) try: - file_path = os.path.join('live', filename) with open(file_path, "w", encoding="utf-8") as f: f.write(content) print(f"✅ 成功生成 {file_path} 文件") @@ -206,4 +207,4 @@ def main(): if __name__ == "__main__": - main() + main()