From 8800a0f19ba9c66d8d17c3c9282fbb90a669d04d Mon Sep 17 00:00:00 2001 From: YuCheng Hu Date: Thu, 11 Mar 2021 10:49:27 -0500 Subject: [PATCH] =?UTF-8?q?=E4=BD=BF=E7=94=A8=20with=20=E8=AF=AD=E5=8F=A5?= =?UTF-8?q?=E5=86=99=E5=85=A5=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/Json2Yaml.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/Json2Yaml.py b/tests/Json2Yaml.py index b16b4a7..b13090a 100644 --- a/tests/Json2Yaml.py +++ b/tests/Json2Yaml.py @@ -2,6 +2,7 @@ # Author - HoneyMoose (https://www.ossez.com) import json + import ruamel.yaml as yaml json_filename = 'resources/black_rock_test.json' @@ -18,6 +19,5 @@ with open(json_filename) as json_file: json_file.close() # Write to YAML -yaml_file = open(yaml_filename, 'w+') -yaml.dump(data, yaml_file, allow_unicode=True) -yaml_file.close() +with open(yaml_filename, 'w') as yaml_file: + yaml.dump(data, yaml_file, allow_unicode=True)