From a0e846d46c57beb4424f08c2f1ec889479ef6233 Mon Sep 17 00:00:00 2001 From: Pat Prochacki <pat.prochacki@strath.ac.uk> Date: Thu, 1 Feb 2024 16:26:41 +0000 Subject: [PATCH] Update file letters.py --- lec2/letters.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lec2/letters.py b/lec2/letters.py index 22f445c..5cc8793 100755 --- a/lec2/letters.py +++ b/lec2/letters.py @@ -10,7 +10,7 @@ def file2prob(filename): letter_dict = { c: 0 for c in letters } letter_total = 0 - with open(filename) as fp: + with open(filename, encoding="utf-8") as fp: for c in fp.read(): if c.lower() not in letter_dict: continue @@ -30,7 +30,7 @@ def file2pairs(filename): letter_dict = { c: { a: 0 for a in letters } for c in letters } previous = None - with open(filename) as fp: + with open(filename, encdoing="utf-8") as fp: for c in fp.read(): if c not in letter_dict: continue -- GitLab