From b69313884dd83526976fb1f51fd54e8609b68524 Mon Sep 17 00:00:00 2001 From: luca hu Date: Tue, 28 Mar 2023 19:34:18 +0800 Subject: [PATCH] improving garbled words issue with utf8 --- toolbox.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolbox.py b/toolbox.py index e779eef..0deedf8 100644 --- a/toolbox.py +++ b/toolbox.py @@ -49,7 +49,7 @@ def write_results_to_file(history, file_name=None): if file_name is None: file_name = time.strftime("chatGPT分析报告%Y-%m-%d-%H-%M-%S", time.localtime()) + '.md' os.makedirs('./gpt_log/', exist_ok=True) - with open(f'./gpt_log/{file_name}', 'w') as f: + with open(f'./gpt_log/{file_name}', 'w', encoding = 'utf8') as f: f.write('# chatGPT 分析报告\n') for i, content in enumerate(history): if i%2==0: f.write('## ')