From 6367c617e7a719ab4d04a936063b8a16d577f67f Mon Sep 17 00:00:00 2001 From: wangweiye7840 Date: Tue, 23 Jan 2024 13:49:31 +0800 Subject: [PATCH] =?UTF-8?q?database=5Ftools=E5=A2=9E=E5=8A=A0AppendTextFil?= =?UTF-8?q?e=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 工具v2/database_tools.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/工具v2/database_tools.py b/工具v2/database_tools.py index fff6efb5..366b3843 100644 --- a/工具v2/database_tools.py +++ b/工具v2/database_tools.py @@ -24,6 +24,11 @@ def SaveTextFile(data,filepath): #写入文本格式的文件 f.write(data) return filepath #返回文件名 +def AppendTextFile(string,filepath): #在文本文件后添加内容 + with open(filepath,"a",encoding = "u8") as f: + f.write(string.strip()+"\n\n") + return filepath #返回文件名 + def SortDict(adict): #按字典项顺序排序字典 return dict(sorted(adict.items())) #返回排序后的字典