From f37e099067736ce14571aab9c146ba971a5a00b7 Mon Sep 17 00:00:00 2001 From: zhanghan2021 Date: Thu, 23 Nov 2023 15:04:18 +0800 Subject: [PATCH] Write the given data to a file --- common/command.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/common/command.py b/common/command.py index 59a9956..a433f25 100644 --- a/common/command.py +++ b/common/command.py @@ -138,4 +138,16 @@ class Command: info = "write file" Logger().error("An exception occurred when executing [{}]: {}".format(info, err)) return False - \ No newline at end of file + + @staticmethod + def cmd_write_file(data, file_name, caller = ''): + ''' + write the file + ''' + try: + FileOperation.write(data, file_name) + return True + except Exception as err: + info = "write file" + Logger().error("An exception occurred when executing [{}]: {}".format(info, err)) + return False -- Gitee