From a2bd82213d861d6eb9519a607ec8288aa299ab4e Mon Sep 17 00:00:00 2001 From: ps2frfkjn <781446156@qq.com> Date: Tue, 21 Nov 2023 12:08:53 +0800 Subject: [PATCH] ADD file via upload --- Save.py | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 Save.py diff --git a/Save.py b/Save.py new file mode 100644 index 0000000..699bcb0 --- /dev/null +++ b/Save.py @@ -0,0 +1,7 @@ +def save(lst): + try: + stu_text=open(filename,'a',encoding='utf-8')#打开文件,以追加的形式 + except: + stu_text=open(filename,'w',encoding='utf-8')#以只写的形式打开文件 + for item in lst: + stu_text.write(str(item)+'\n')