diff --git a/clean_logs.py b/clean_logs.py index abe2ec0..ca91b51 100644 --- a/clean_logs.py +++ b/clean_logs.py @@ -13,7 +13,7 @@ def clean_log_files(directory): # 清理超过7天的日志记录 if os.path.exists(log_file): - with open(log_file, 'r+') as f: + with open(log_file, 'r+', encoding='utf-8') as f: lines = f.readlines() f.seek(0) for line in lines: