From c8feed79d722c8d828ca1ddb05879824b5b95590 Mon Sep 17 00:00:00 2001 From: lixiaoyong Date: Sat, 14 Sep 2024 22:41:05 +0800 Subject: [PATCH] Add function readfile --- common/file.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/common/file.py b/common/file.py index 8d042c5..c086954 100644 --- a/common/file.py +++ b/common/file.py @@ -70,3 +70,10 @@ class FileOperation: dist_list.append(i) i = i + 1 return dist_list + + @staticmethod + def readfile(filename): + txt = '' + with io.open(file = filename, mode = 'r', encoding = 'utf-8') as fp: + txt = fp.read() + return txt -- Gitee