From 01fd0dc91fbb9defcd5aa90635754befdc71dfd1 Mon Sep 17 00:00:00 2001
From: Administrator <admin@example.com>
Date: 星期二, 22 八月 2023 16:31:02 +0800
Subject: [PATCH] 添加托管交易通道测试

---
 utils/data_export_util.py |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/utils/data_export_util.py b/utils/data_export_util.py
index 4ef3bec..73d86f3 100644
--- a/utils/data_export_util.py
+++ b/utils/data_export_util.py
@@ -50,12 +50,9 @@
     local_time = time.strftime("%Y%m%dT%H%M%S", time.localtime(time.time()))
     file_name = "{}/{}_{}.xls".format(dest_dir, code, local_time)
     file_name_txt = "{}/{}_{}.txt".format(dest_dir, code, local_time)
-    openfile = open(file_name_txt, 'w')
-    try:
+    with open(file_name_txt, 'w') as openfile:
         for data in datas:
             openfile.write(json.dumps(data) + "\n")
-    finally:
-        openfile.close()
     wb = xlwt.Workbook(encoding="utf-8")
     ws = wb.add_sheet('sheet1')
     ws.write(0, 0, '搴忓彿')

--
Gitblit v1.8.0