From bba50a4e41b61909501b60158438ca0a8aeef01e Mon Sep 17 00:00:00 2001 From: George Tian Date: Tue, 2 Jul 2024 00:36:39 +0800 Subject: [PATCH] Fix error: UnicodeEncodeError: 'charmap' codec can't encode characters in position 0-1: character maps to (#25) --- learn.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/learn.py b/learn.py index 4b8de0e..93836ef 100755 --- a/learn.py +++ b/learn.py @@ -269,7 +269,8 @@ def append_hw_csv(fname, stu): f[i] = info_str else: f.append(info_str) - csv.writer(open(fname, 'w')).writerows(f) + csv.writer(open(fname, 'w', encoding='utf8')).writerows(f) + def sync_hw(c):